explain.depesz.com

PostgreSQL's explain analyze made readable

Result: birk

Settings
# exclusive inclusive rows x rows loops node
1. 8.774 2,317.963 ↓ 1.3 17,103 1

Append (cost=3,550.17..1,638,773.51 rows=12,797 width=1,042) (actual time=10.334..2,317.963 rows=17,103 loops=1)

2. 9.223 1,001.896 ↑ 1.4 8,849 1

Subquery Scan on *SELECT* 1 (cost=3,550.17..48,481.60 rows=12,160 width=716) (actual time=10.333..1,001.896 rows=8,849 loops=1)

3. 947.348 992.673 ↑ 1.4 8,849 1

Hash Join (cost=3,550.17..48,299.20 rows=12,160 width=712) (actual time=10.331..992.673 rows=8,849 loops=1)

  • Hash Cond: (d.impact_score = ei.impact_score)
4. 7.159 45.314 ↑ 1.4 8,849 1

Hash Join (cost=3,532.52..32,654.03 rows=12,160 width=405) (actual time=9.625..45.314 rows=8,849 loops=1)

  • Hash Cond: (d.responsible_org_orgref = resporg.swa_org_ref)
5. 11.611 37.338 ↑ 1.4 8,849 1

Hash Join (cost=3,480.07..32,569.55 rows=12,160 width=383) (actual time=8.803..37.338 rows=8,849 loops=1)

  • Hash Cond: (d.publisher_orgref = publisher.swa_org_ref)
6. 17.598 24.943 ↑ 1.4 8,849 1

Bitmap Heap Scan on entity_eton_agg d (cost=3,427.61..32,485.08 rows=12,160 width=361) (actual time=8.013..24.943 rows=8,849 loops=1)

  • Recheck Cond: ((start_date <= ((CURRENT_DATE + '1 day'::interval) - '00:00:01'::interval)) AND (end_date >= (CURRENT_DATE)::timestamp without time zone) AND (works_state = ANY ('{0,2,3,4,5,6,7,8}'::integer[])))
  • Filter: active
  • Heap Blocks: exact=5422
7. 7.345 7.345 ↑ 1.4 8,849 1

Bitmap Index Scan on idx_entity_eton_agg_active_dates_works_state_impact (cost=0.00..3,424.57 rows=12,160 width=0) (actual time=7.345..7.345 rows=8,849 loops=1)

  • Index Cond: ((active = true) AND (start_date <= ((CURRENT_DATE + '1 day'::interval) - '00:00:01'::interval)) AND (end_date >= (CURRENT_DATE)::timestamp without time zone) AND (works_state = ANY ('{0,2,3,4,5,6,7,8}'::integer[])))
8. 0.385 0.784 ↑ 1.0 1,309 1

Hash (cost=36.09..36.09 rows=1,309 width=26) (actual time=0.783..0.784 rows=1,309 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
9. 0.399 0.399 ↑ 1.0 1,309 1

Seq Scan on orgref publisher (cost=0.00..36.09 rows=1,309 width=26) (actual time=0.002..0.399 rows=1,309 loops=1)

10. 0.390 0.817 ↑ 1.0 1,309 1

Hash (cost=36.09..36.09 rows=1,309 width=26) (actual time=0.816..0.817 rows=1,309 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
11. 0.427 0.427 ↑ 1.0 1,309 1

Seq Scan on orgref resporg (cost=0.00..36.09 rows=1,309 width=26) (actual time=0.002..0.427 rows=1,309 loops=1)

12. 0.005 0.011 ↑ 68.0 5 1

Hash (cost=13.40..13.40 rows=340 width=92) (actual time=0.011..0.011 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
13. 0.006 0.006 ↑ 68.0 5 1

Seq Scan on eton_impact ei (cost=0.00..13.40 rows=340 width=92) (actual time=0.004..0.006 rows=5 loops=1)

14. 6.839 1,307.293 ↓ 13.0 8,254 1

Subquery Scan on *SELECT* 2 (cost=1,587,394.22..1,590,291.91 rows=637 width=1,042) (actual time=56.901..1,307.293 rows=8,254 loops=1)

15. 14.964 1,300.454 ↓ 13.0 8,254 1

Hash Join (cost=1,587,394.22..1,590,285.54 rows=637 width=1,068) (actual time=56.900..1,300.454 rows=8,254 loops=1)

  • Hash Cond: ((entities.entity_category)::text = (ecat.nsa_code)::text)
16.          

CTE live_orgs

17. 0.032 0.045 ↓ 8.5 93 1

Bitmap Heap Scan on organisation_extended_funcs (cost=4.37..15.04 rows=11 width=4) (actual time=0.019..0.045 rows=93 loops=1)

  • Recheck Cond: (extended_function_id = 14)
  • Heap Blocks: exact=3
18. 0.013 0.013 ↓ 8.5 93 1

Bitmap Index Scan on organisation_extended_funcs_pkey (cost=0.00..4.36 rows=11 width=0) (actual time=0.013..0.013 rows=93 loops=1)

  • Index Cond: (extended_function_id = 14)
19.          

CTE entities

20. 896.423 1,252.317 ↑ 15.3 8,338 1

Hash Left Join (cost=416,705.35..1,587,368.67 rows=127,480 width=643) (actual time=56.850..1,252.317 rows=8,338 loops=1)

  • Hash Cond: (d_1.publisher_organisation_id = live_orgs.organisation_id)
21. 7.219 355.772 ↑ 15.3 8,338 1

Hash Join (cost=416,705.00..1,074,034.27 rows=127,480 width=437) (actual time=56.492..355.772 rows=8,338 loops=1)

  • Hash Cond: (d_1.impact_score = ei_1.impact_score)
22. 7.003 348.542 ↑ 15.3 8,338 1

Hash Join (cost=416,687.35..1,073,677.81 rows=127,480 width=349) (actual time=56.472..348.542 rows=8,338 loops=1)

  • Hash Cond: (d_1.responsible_org_orgref = resporg_1.swa_org_ref)
23. 8.043 340.609 ↑ 15.3 8,339 1

Hash Join (cost=416,634.89..1,073,289.65 rows=127,480 width=327) (actual time=55.536..340.609 rows=8,339 loops=1)

  • Hash Cond: (d_1.publisher_orgref = publisher_1.swa_org_ref)
24. 283.524 331.698 ↑ 15.3 8,340 1

Bitmap Heap Scan on entity d_1 (cost=416,582.44..1,072,901.48 rows=127,480 width=305) (actual time=54.659..331.698 rows=8,340 loops=1)

  • Recheck Cond: (entity_type > 1)
  • Rows Removed by Index Recheck: 5621
  • Filter: (active AND (published = 1) AND (LOCALTIMESTAMP > publish_date) AND (end_date >= (CURRENT_DATE)::timestamp without time zone) AND (start_date <= ((CURRENT_DATE + '1 day'::interval) - '00:00:01'::interval)))
  • Rows Removed by Filter: 373599
  • Heap Blocks: exact=37152 lossy=34476
25. 48.174 48.174 ↑ 1.1 218,951 1

Bitmap Index Scan on idx_entity_type_active (cost=0.00..416,550.57 rows=240,627 width=0) (actual time=48.174..48.174 rows=218,951 loops=1)

  • Index Cond: ((entity_type > 1) AND (active = true))
26. 0.429 0.868 ↑ 1.0 1,309 1

Hash (cost=36.09..36.09 rows=1,309 width=26) (actual time=0.867..0.868 rows=1,309 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
27. 0.439 0.439 ↑ 1.0 1,309 1

Seq Scan on orgref publisher_1 (cost=0.00..36.09 rows=1,309 width=26) (actual time=0.003..0.439 rows=1,309 loops=1)

28. 0.448 0.930 ↑ 1.0 1,309 1

Hash (cost=36.09..36.09 rows=1,309 width=26) (actual time=0.930..0.930 rows=1,309 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
29. 0.482 0.482 ↑ 1.0 1,309 1

Seq Scan on orgref resporg_1 (cost=0.00..36.09 rows=1,309 width=26) (actual time=0.004..0.482 rows=1,309 loops=1)

30. 0.004 0.011 ↑ 68.0 5 1

Hash (cost=13.40..13.40 rows=340 width=92) (actual time=0.011..0.011 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
31. 0.007 0.007 ↑ 68.0 5 1

Seq Scan on eton_impact ei_1 (cost=0.00..13.40 rows=340 width=92) (actual time=0.005..0.007 rows=5 loops=1)

32. 0.027 0.122 ↓ 8.5 93 1

Hash (cost=0.22..0.22 rows=11 width=4) (actual time=0.122..0.122 rows=93 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
33. 0.095 0.095 ↓ 8.5 93 1

CTE Scan on live_orgs (cost=0.00..0.22 rows=11 width=4) (actual time=0.021..0.095 rows=93 loops=1)

34. 1,285.455 1,285.455 ↑ 15.3 8,338 1

CTE Scan on entities (cost=0.00..2,549.60 rows=127,480 width=1,068) (actual time=56.856..1,285.455 rows=8,338 loops=1)

35. 0.011 0.035 ↓ 31.0 31 1

Hash (cost=10.50..10.50 rows=1 width=118) (actual time=0.035..0.035 rows=31 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
36. 0.024 0.024 ↓ 31.0 31 1

Seq Scan on entity_category ecat (cost=0.00..10.50 rows=1 width=118) (actual time=0.008..0.024 rows=31 loops=1)

  • Filter: ((entitygroupid)::text = 'RW'::text)
  • Rows Removed by Filter: 61