explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QaeA

Settings
# exclusive inclusive rows x rows loops node
1. 788.433 44,009.824 ↑ 194.3 125 1

Unique (cost=51,839.96..62,039.24 rows=24,284 width=1,310) (actual time=32,566.331..44,009.824 rows=125 loops=1)

2. 42,820.183 43,221.391 ↓ 8.6 208,599 1

Sort (cost=51,839.96..51,900.67 rows=24,284 width=1,310) (actual time=32,566.329..43,221.391 rows=208,599 loops=1)

  • Sort Key: slr_departmen.code, slr_departmen.short_name, slr_departmen.id, slr_departmen.begin, slr_departmen."end", slr_departmen.created, slr_departmen.modified, slr_departmen.external_id, slr_departmen.uuid, slr_departmen.full_name, slr_departmen (...)
  • Sort Method: external merge Disk: 105704kB
3. 119.721 401.208 ↓ 8.6 208,599 1

Nested Loop (cost=1.14..36,207.65 rows=24,284 width=1,310) (actual time=2.584..401.208 rows=208,599 loops=1)

  • Join Filter: (slr_departmen.id = t3.department_id)
4. 3.323 22.620 ↓ 2.1 4,109 1

Nested Loop (cost=0.71..31,488.58 rows=1,917 width=1,314) (actual time=2.566..22.620 rows=4,109 loops=1)

5. 0.371 14.647 ↓ 1.0 155 1

Nested Loop Left Join (cost=0.29..2,879.77 rows=152 width=1,310) (actual time=0.307..14.647 rows=155 loops=1)

  • Join Filter: (slr_departmen.place_group_id = slr_dict_place_group.id)
  • Rows Removed by Join Filter: 620
6. 0.724 14.121 ↓ 1.0 155 1

Nested Loop Left Join (cost=0.29..2,869.60 rows=152 width=732) (actual time=0.280..14.121 rows=155 loops=1)

7. 12.467 12.467 ↓ 1.0 155 1

Seq Scan on slr_departmen (cost=0.00..1,902.86 rows=152 width=366) (actual time=0.259..12.467 rows=155 loops=1)

  • Filter: ((("end" >= '2020-01-01'::date) OR ("end" IS NULL)) AND (begin <= '2020-01-31'::date) AND (ent_id = 3948) AND (state = 0))
  • Rows Removed by Filter: 35938
8. 0.930 0.930 ↑ 1.0 1 155

Index Scan using slr_departmen_pkey on slr_departmen t4 (cost=0.29..6.36 rows=1 width=366) (actual time=0.006..0.006 rows=1 loops=155)

  • Index Cond: (slr_departmen.parent_id = id)
9. 0.147 0.155 ↑ 1.0 4 155

Materialize (cost=0.00..1.06 rows=4 width=578) (actual time=0.000..0.001 rows=4 loops=155)

10. 0.008 0.008 ↑ 1.0 4 1

Seq Scan on slr_dict_place_group (cost=0.00..1.04 rows=4 width=578) (actual time=0.007..0.008 rows=4 loops=1)

11. 4.650 4.650 ↑ 1.4 27 155

Index Scan using slr_employee_department_id on slr_employee (cost=0.42..187.85 rows=37 width=4) (actual time=0.009..0.030 rows=27 loops=155)

  • Index Cond: (department_id = slr_departmen.id)
  • Filter: ((admission_date <= '2020-01-31'::date) AND ((lay_off_date IS NULL) OR (lay_off_date >= '2020-01-01'::date)))
  • Rows Removed by Filter: 9
12. 258.867 258.867 ↓ 1.4 51 4,109

Index Scan using slr_employee_department_id on slr_employee t3 (cost=0.42..2.00 rows=37 width=4) (actual time=0.007..0.063 rows=51 loops=4,109)

  • Index Cond: (department_id = slr_employee.department_id)
  • Filter: (job_type = 1)
  • Rows Removed by Filter: 40
Planning time : 32.858 ms
Execution time : 44,033.255 ms