explain.depesz.com

PostgreSQL's explain analyze made readable

Result: H4Ka

Settings
# exclusive inclusive rows x rows loops node
1. 265.572 8,236.670 ↑ 4.0 1,675 1

HashAggregate (cost=885,723.15..885,790.15 rows=6,700 width=127) (actual time=8,236.079..8,236.670 rows=1,675 loops=1)

  • Group Key: core_employee.id, core_employee.logical_timestamp, core_employee.uuid, core_employee.company_id, core_employee.number, core_employee.initial, core_employee.name, core_employee.cpr_number, core_employee.street_address, core_employee.zip_code, core_employee.city, core_employee.country, core_employee.phone, core_employee.email, core_employee."may_CUD_customers_and_cases", core_employee.may_add_work_reports_to_all_cases, core_employee.wipe_native_clients_logged_in_before, core_employee.file_server_auth_hash, core_employee.car_registration_number, core_employee.responsible_id, core_employee.co_responsible_id, core_employee.department_id, core_employee.employee_group_id
2. 3,444.775 7,971.098 ↓ 11.8 226,402 1

Hash Left Join (cost=78,815.72..884,623.86 rows=19,118 width=127) (actual time=796.072..7,971.098 rows=226,402 loops=1)

  • Hash Cond: (core_case.department_id = t11.id)
  • Filter: ((((core_employee_new_responsible.responsible_id = 4424) OR (core_department_new_responsible.responsible_id = 4424)) AND (((core_responsible.level)::text = 'first_approver'::text) OR ((t6.level)::text = 'first_approver'::text) OR ((core_responsible.level)::text = 'second_approver'::text) OR ((t6.level)::text = 'second_approver'::text) OR ((core_responsible.level)::text = 'third_approver'::text) OR ((t6.level)::text = 'third_approver'::text) OR ((core_responsible.level)::text = 'final_approver'::text) OR ((t6.level)::text = 'final_approver'::text))) OR (((core_case_new_responsible.responsible_id = 4424) OR (t12.responsible_id = 4424)) AND (((t10.level)::text = 'first_approver'::text) OR ((t13.level)::text = 'first_approver'::text) OR ((t10.level)::text = 'second_approver'::text) OR ((t13.level)::text = 'second_approver'::text) OR ((t10.level)::text = 'third_approver'::text) OR ((t13.level)::text = 'third_approver'::text) OR ((t10.level)::text = 'final_approver'::text) OR ((t13.level)::text = 'final_approver'::text))))
  • Rows Removed by Filter: 4563230
3. 1,179.198 4,525.049 ↓ 10.5 4,789,632 1

Hash Left Join (cost=78,715.23..878,574.39 rows=454,795 width=188) (actual time=794.709..4,525.049 rows=4,789,632 loops=1)

  • Hash Cond: (core_case_new_responsible.responsible_id = t10.id)
4. 1,272.411 3,345.379 ↓ 10.5 4,789,632 1

Hash Left Join (cost=78,665.34..872,271.07 rows=454,795 width=173) (actual time=794.212..3,345.379 rows=4,789,632 loops=1)

  • Hash Cond: (core_case.id = core_case_new_responsible.case_id)
5. 906.004 2,000.482 ↓ 10.0 4,554,960 1

Hash Left Join (cost=71,544.76..854,760.10 rows=454,795 width=173) (actual time=720.501..2,000.482 rows=4,554,960 loops=1)

  • Hash Cond: (core_employee.department_id = core_department.id)
6. 20.988 1,093.273 ↑ 4.1 94,895 1

Hash Left Join (cost=71,444.27..852,496.89 rows=393,279 width=154) (actual time=719.279..1,093.273 rows=94,895 loops=1)

  • Hash Cond: (core_employee.id = core_employee_new_responsible.employee_id)
7. 235.329 1,065.138 ↑ 4.1 94,895 1

Hash Left Join (cost=71,040.26..845,316.61 rows=393,279 width=135) (actual time=712.031..1,065.138 rows=94,895 loops=1)

  • Hash Cond: (core_workreport.case_id = core_case.id)
8. 19.368 122.945 ↑ 4.1 94,895 1

Nested Loop Left Join (cost=0.73..747,176.37 rows=393,279 width=131) (actual time=2.414..122.945 rows=94,895 loops=1)

9. 4.752 4.752 ↑ 1.0 1,675 1

Index Scan using core_employee_company_id on core_employee (cost=0.29..830.25 rows=1,675 width=127) (actual time=2.397..4.752 rows=1,675 loops=1)

  • Index Cond: (company_id = 7701)
10. 98.825 98.825 ↑ 12.4 56 1,675

Index Scan using core_workreport_employee_id on core_workreport (cost=0.44..438.64 rows=694 width=8) (actual time=0.003..0.059 rows=56 loops=1,675)

  • Index Cond: (core_employee.id = employee_id)
11. 283.591 706.864 ↑ 1.0 1,598,290 1

Hash (cost=44,816.90..44,816.90 rows=1,598,290 width=8) (actual time=706.864..706.864 rows=1,598,290 loops=1)

  • Buckets: 524288 Batches: 8 Memory Usage: 11285kB
12. 423.273 423.273 ↑ 1.0 1,598,290 1

Seq Scan on core_case (cost=0.00..44,816.90 rows=1,598,290 width=8) (actual time=0.006..423.273 rows=1,598,290 loops=1)

13. 1.594 7.147 ↑ 1.0 8,500 1

Hash (cost=297.76..297.76 rows=8,500 width=23) (actual time=7.147..7.147 rows=8,500 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 585kB
14. 2.173 5.553 ↑ 1.0 8,500 1

Hash Left Join (cost=49.89..297.76 rows=8,500 width=23) (actual time=0.557..5.553 rows=8,500 loops=1)

  • Hash Cond: (core_employee_new_responsible.responsible_id = core_responsible.id)
15. 2.848 2.848 ↑ 1.0 8,500 1

Seq Scan on core_employee_new_responsible (cost=0.00..131.00 rows=8,500 width=8) (actual time=0.006..2.848 rows=8,500 loops=1)

16. 0.303 0.532 ↑ 1.0 1,595 1

Hash (cost=29.95..29.95 rows=1,595 width=19) (actual time=0.532..0.532 rows=1,595 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 96kB
17. 0.229 0.229 ↑ 1.0 1,595 1

Seq Scan on core_responsible (cost=0.00..29.95 rows=1,595 width=19) (actual time=0.006..0.229 rows=1,595 loops=1)

18. 0.177 1.205 ↓ 1.8 1,083 1

Hash (cost=93.00..93.00 rows=599 width=23) (actual time=1.205..1.205 rows=1,083 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 66kB
19. 0.210 1.028 ↓ 1.8 1,083 1

Hash Left Join (cost=66.54..93.00 rows=599 width=23) (actual time=0.614..1.028 rows=1,083 loops=1)

  • Hash Cond: (core_department_new_responsible.responsible_id = t6.id)
20. 0.194 0.377 ↓ 1.8 1,083 1

Hash Right Join (cost=16.66..34.88 rows=599 width=8) (actual time=0.153..0.377 rows=1,083 loops=1)

  • Hash Cond: (core_department_new_responsible.department_id = core_department.id)
21. 0.050 0.050 ↑ 1.0 599 1

Seq Scan on core_department_new_responsible (cost=0.00..9.99 rows=599 width=8) (actual time=0.005..0.050 rows=599 loops=1)

22. 0.068 0.133 ↑ 1.0 518 1

Hash (cost=10.18..10.18 rows=518 width=4) (actual time=0.133..0.133 rows=518 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
23. 0.065 0.065 ↑ 1.0 518 1

Seq Scan on core_department (cost=0.00..10.18 rows=518 width=4) (actual time=0.005..0.065 rows=518 loops=1)

24. 0.251 0.441 ↑ 1.0 1,595 1

Hash (cost=29.95..29.95 rows=1,595 width=19) (actual time=0.441..0.441 rows=1,595 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 96kB
25. 0.190 0.190 ↑ 1.0 1,595 1

Seq Scan on core_responsible t6 (cost=0.00..29.95 rows=1,595 width=19) (actual time=0.003..0.190 rows=1,595 loops=1)

26. 41.102 72.486 ↑ 1.0 255,137 1

Hash (cost=3,931.37..3,931.37 rows=255,137 width=8) (actual time=72.486..72.486 rows=255,137 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 12015kB
27. 31.384 31.384 ↑ 1.0 255,137 1

Seq Scan on core_case_new_responsible (cost=0.00..3,931.37 rows=255,137 width=8) (actual time=0.007..31.384 rows=255,137 loops=1)

28. 0.243 0.472 ↑ 1.0 1,595 1

Hash (cost=29.95..29.95 rows=1,595 width=19) (actual time=0.472..0.472 rows=1,595 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 96kB
29. 0.229 0.229 ↑ 1.0 1,595 1

Seq Scan on core_responsible t10 (cost=0.00..29.95 rows=1,595 width=19) (actual time=0.005..0.229 rows=1,595 loops=1)

30. 0.169 1.274 ↓ 1.8 1,083 1

Hash (cost=93.00..93.00 rows=599 width=23) (actual time=1.274..1.274 rows=1,083 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 66kB
31. 0.218 1.105 ↓ 1.8 1,083 1

Hash Left Join (cost=66.54..93.00 rows=599 width=23) (actual time=0.676..1.105 rows=1,083 loops=1)

  • Hash Cond: (t12.responsible_id = t13.id)
32. 0.222 0.420 ↓ 1.8 1,083 1

Hash Right Join (cost=16.66..34.88 rows=599 width=8) (actual time=0.177..0.420 rows=1,083 loops=1)

  • Hash Cond: (t12.department_id = t11.id)
33. 0.059 0.059 ↑ 1.0 599 1

Seq Scan on core_department_new_responsible t12 (cost=0.00..9.99 rows=599 width=8) (actual time=0.019..0.059 rows=599 loops=1)

34. 0.074 0.139 ↑ 1.0 518 1

Hash (cost=10.18..10.18 rows=518 width=4) (actual time=0.139..0.139 rows=518 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 27kB
35. 0.065 0.065 ↑ 1.0 518 1

Seq Scan on core_department t11 (cost=0.00..10.18 rows=518 width=4) (actual time=0.005..0.065 rows=518 loops=1)

36. 0.257 0.467 ↑ 1.0 1,595 1

Hash (cost=29.95..29.95 rows=1,595 width=19) (actual time=0.467..0.467 rows=1,595 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 96kB
37. 0.210 0.210 ↑ 1.0 1,595 1

Seq Scan on core_responsible t13 (cost=0.00..29.95 rows=1,595 width=19) (actual time=0.003..0.210 rows=1,595 loops=1)

Planning time : 5.333 ms
Execution time : 8,237.615 ms