explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cHxZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.204 58.475 ↑ 2.3 132 1

Sort (cost=1,979.11..1,979.87 rows=305 width=443) (actual time=58.463..58.475 rows=132 loops=1)

  • Sort Key: financial_structure_financialunit.created DESC
  • Sort Method: quicksort Memory: 84kB
2. 0.000 58.271 ↑ 2.3 132 1

Hash Join (cost=1,919.43..1,966.52 rows=305 width=443) (actual time=57.821..58.271 rows=132 loops=1)

  • Hash Cond: (financial_structure_financialunit.uid = recursetree.uid)
3. 0.155 0.155 ↑ 1.0 610 1

Seq Scan on financial_structure_financialunit (cost=0.00..42.10 rows=610 width=443) (actual time=0.011..0.155 rows=610 loops=1)

4. 0.057 57.798 ↑ 1.5 132 1

Hash (cost=1,916.93..1,916.93 rows=200 width=16) (actual time=57.798..57.798 rows=132 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
5. 0.146 57.741 ↑ 1.5 132 1

HashAggregate (cost=1,914.93..1,916.93 rows=200 width=16) (actual time=57.694..57.741 rows=132 loops=1)

  • Group Key: recursetree.uid
6. 57.595 57.595 ↑ 30.6 132 1

CTE Scan on recursetree (cost=1,783.63..1,864.43 rows=4,040 width=16) (actual time=55.440..57.595 rows=132 loops=1)

7.          

CTE recursetree

8. 1.447 57.360 ↑ 30.6 132 1

Recursive Union (cost=1,090.73..1,783.63 rows=4,040 width=443) (actual time=55.434..57.360 rows=132 loops=1)

9. 0.463 55.913 ↓ 2.3 93 1

Nested Loop (cost=1,090.73..1,114.96 rows=40 width=443) (actual time=55.420..55.913 rows=93 loops=1)

10. 55.450 55.450 ↓ 2.3 93 1

HashAggregate (cost=1,090.45..1,090.85 rows=40 width=32) (actual time=55.403..55.450 rows=93 loops=1)

  • Group Key: financial_structure_financialunit_1.uid
11. 0.057 57.798 ↑ 1.5 132 1

Hash (cost=1,916.93..1,916.93 rows=200 width=16) (actual time=57.798..57.798 rows=132 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
12. 0.146 57.741 ↑ 1.5 132 1

HashAggregate (cost=1,914.93..1,916.93 rows=200 width=16) (actual time=57.694..57.741 rows=132 loops=1)

  • Group Key: recursetree.uid
13. 57.595 57.595 ↑ 30.6 132 1

CTE Scan on recursetree (cost=1,783.63..1,864.43 rows=4,040 width=16) (actual time=55.440..57.595 rows=132 loops=1)

14.          

CTE recursetree

15. 0.743 57.360 ↑ 30.6 132 1

Recursive Union (cost=1,090.73..1,783.63 rows=4,040 width=443) (actual time=55.434..57.360 rows=132 loops=1)

16. 0.091 55.913 ↓ 2.3 93 1

Nested Loop (cost=1,090.73..1,114.96 rows=40 width=443) (actual time=55.420..55.913 rows=93 loops=1)

17. 0.513 55.450 ↓ 2.3 93 1

HashAggregate (cost=1,090.45..1,090.85 rows=40 width=32) (actual time=55.403..55.450 rows=93 loops=1)

  • Group Key: financial_structure_financialunit_1.uid
18. 0.541 54.937 ↓ 13.2 528 1

Nested Loop (cost=1,035.18..1,090.35 rows=40 width=32) (actual time=14.196..54.937 rows=528 loops=1)

19. 0.948 52.284 ↓ 10.6 528 1

Nested Loop (cost=1,034.90..1,073.71 rows=50 width=16) (actual time=14.176..52.284 rows=528 loops=1)

20. 3.763 46.166 ↓ 95.7 5,170 1

Nested Loop (cost=1,034.62..1,057.34 rows=54 width=16) (actual time=14.048..46.166 rows=5,170 loops=1)

21. 6.499 16.553 ↓ 95.7 5,170 1

HashAggregate (cost=1,034.33..1,034.87 rows=54 width=4) (actual time=14.018..16.553 rows=5,170 loops=1)

  • Group Key: u0.id
22. 0.975 10.054 ↓ 95.7 5,170 1

Nested Loop (cost=11.72..1,034.19 rows=54 width=4) (actual time=2.082..10.054 rows=5,170 loops=1)

23. 0.018 0.018 ↑ 1.0 1 1

Index Scan using staff_organization_uid_key on staff_organization u1 (cost=0.28..8.29 rows=1 width=4) (actual time=0.014..0.018 rows=1 loops=1)

  • Index Cond: (uid = '1b48c4f3-7fb4-4c53-85bc-87d1589b7105'::uuid)
24. 7.442 9.061 ↓ 12.7 5,170 1

Bitmap Heap Scan on staff_employment u0 (cost=11.45..1,021.83 rows=407 width=8) (actual time=2.062..9.061 rows=5,170 loops=1)

  • Recheck Cond: (organization_id = u1.id)
  • Filter: ((deleted IS NULL) AND (deleted IS NULL) AND (deleted IS NULL))
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=1788
25. 1.619 1.619 ↓ 12.7 5,171 1

Bitmap Index Scan on staff_employment_organization_id_7dbf4a96 (cost=0.00..11.35 rows=407 width=0) (actual time=1.619..1.619 rows=5,171 loops=1)

  • Index Cond: (organization_id = u1.id)
26. 25.850 25.850 ↑ 1.0 1 5,170

Index Scan using staff_employment_pkey on staff_employment (cost=0.29..0.42 rows=1 width=20) (actual time=0.005..0.005 rows=1 loops=5,170)

  • Index Cond: (id = u0.id)
  • Filter: (deleted IS NULL)
27. 5.170 5.170 ↓ 0.0 0 5,170

Index Scan using financial_structure_financialemployment_pkey on financial_structure_financialemployment (cost=0.28..0.30 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=5,170)

  • Index Cond: (uid = staff_employment.financial_employment_id)
  • Filter: (deleted IS NULL)
28. 2.112 2.112 ↑ 1.0 1 528

Index Scan using financial_structure_financialunit_pkey on financial_structure_financialunit financial_structure_financialunit_1 (cost=0.28..0.33 rows=1 width=16) (actual time=0.004..0.004 rows=1 loops=528)

  • Index Cond: (uid = financial_structure_financialemployment.financial_unit_id)
  • Filter: ((deleted IS NULL) AND (deleted IS NULL) AND (deleted IS NULL) AND (deleted IS NULL))
29. 0.372 0.372 ↑ 1.0 1 93

Index Scan using financial_structure_financialunit_pkey on financial_structure_financialunit initial (cost=0.28..0.63 rows=1 width=443) (actual time=0.004..0.004 rows=1 loops=93)

  • Index Cond: (uid = financial_structure_financialunit_1.uid)
30. 0.170 0.704 ↑ 12.1 33 4

Hash Join (cost=49.73..58.79 rows=400 width=443) (actual time=0.138..0.176 rows=33 loops=4)

  • Hash Cond: (rt.leader_id = t1.uid)
31. 0.012 0.012 ↑ 12.1 33 4

WorkTable Scan on recursetree rt (cost=0.00..8.00 rows=400 width=16) (actual time=0.001..0.003 rows=33 loops=4)

32. 0.333 0.522 ↑ 1.0 610 1

Hash (cost=42.10..42.10 rows=610 width=443) (actual time=0.522..0.522 rows=610 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 284kB
33. 0.189 0.189 ↑ 1.0 610 1

Seq Scan on financial_structure_financialunit t1 (cost=0.00..42.10 rows=610 width=443) (actual time=0.016..0.189 rows=610 loops=1)

Planning time : 4.292 ms
Execution time : 58.818 ms