explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dF1O

Settings
# exclusive inclusive rows x rows loops node
1. 19.530 2,439.265 ↓ 0.0 0 1

Nested Loop (cost=3,550.43..6,804,532.66 rows=6 width=1,078) (actual time=2,439.265..2,439.265 rows=0 loops=1)

  • Join Filter: (("*SELECT* 1".location_point_wgs84 && gtab.bbox) AND _st_intersects("*SELECT* 1".location_point_wgs84, gtab.bbox))
  • Rows Removed by Join Filter: 18641
2.          

CTE gtab

3. 0.054 0.054 ↑ 1.0 1 1

Result (cost=0.00..0.26 rows=1 width=32) (actual time=0.053..0.054 rows=1 loops=1)

4. 0.058 0.058 ↑ 1.0 1 1

CTE Scan on gtab (cost=0.00..0.02 rows=1 width=32) (actual time=0.056..0.058 rows=1 loops=1)

5. 9.688 2,419.677 ↑ 1.0 18,641 1

Append (cost=3,550.17..6,799,323.81 rows=19,114 width=1,046) (actual time=10.211..2,419.677 rows=18,641 loops=1)

6. 8.676 956.584 ↑ 1.4 8,849 1

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

7. 903.680 947.908 ↑ 1.4 8,849 1

Hash Join (cost=3,550.17..48,299.20 rows=12,160 width=716) (actual time=10.209..947.908 rows=8,849 loops=1)

  • Hash Cond: (d.impact_score = ei.impact_score)
8. 7.570 44.218 ↑ 1.4 8,849 1

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

  • Hash Cond: (d.responsible_org_orgref = resporg.swa_org_ref)
9. 10.963 35.830 ↑ 1.4 8,849 1

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

  • Hash Cond: (d.publisher_orgref = publisher.swa_org_ref)
10. 16.847 24.066 ↑ 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=7.906..24.066 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
11. 7.219 7.219 ↑ 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.219..7.219 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[])))
12. 0.406 0.801 ↑ 1.0 1,309 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
13. 0.395 0.395 ↑ 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.395 rows=1,309 loops=1)

14. 0.389 0.818 ↑ 1.0 1,309 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
15. 0.429 0.429 ↑ 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.429 rows=1,309 loops=1)

16. 0.004 0.010 ↑ 68.0 5 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
17. 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)

18. 7.889 1,453.405 ↓ 1.4 9,792 1

Subquery Scan on *SELECT* 2 (cost=6,719,229.43..6,750,842.21 rows=6,954 width=1,046) (actual time=55.241..1,453.405 rows=9,792 loops=1)

19. 17.570 1,445.516 ↓ 1.4 9,792 1

Hash Join (cost=6,719,229.43..6,750,772.67 rows=6,954 width=1,072) (actual time=55.240..1,445.516 rows=9,792 loops=1)

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

CTE live_orgs

21. 0.032 0.044 ↓ 8.5 93 1

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

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

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

  • Index Cond: (extended_function_id = 14)
23.          

CTE entities

24. 1,029.668 1,389.852 ↑ 138.5 10,040 1

Hash Left Join (cost=416,766.21..6,719,203.88 rows=1,390,757 width=647) (actual time=55.192..1,389.852 rows=10,040 loops=1)

  • Hash Cond: (d_1.publisher_organisation_id = oef.organisation_id)
25. 6.706 359.949 ↑ 15.3 8,335 1

Hash Left Join (cost=416,705.36..1,074,580.50 rows=127,491 width=437) (actual time=54.757..359.949 rows=8,335 loops=1)

  • Hash Cond: (d_1.publisher_organisation_id = live_orgs.organisation_id)
26. 6.600 353.124 ↑ 15.3 8,335 1

Hash Join (cost=416,705.00..1,074,034.36 rows=127,491 width=437) (actual time=54.628..353.124 rows=8,335 loops=1)

  • Hash Cond: (d_1.impact_score = ei_1.impact_score)
27. 7.050 346.513 ↑ 15.3 8,335 1

Hash Join (cost=416,687.35..1,073,677.87 rows=127,491 width=349) (actual time=54.609..346.513 rows=8,335 loops=1)

  • Hash Cond: (d_1.responsible_org_orgref = resporg_1.swa_org_ref)
28. 8.197 338.652 ↑ 15.3 8,336 1

Hash Join (cost=416,634.90..1,073,289.68 rows=127,491 width=327) (actual time=53.790..338.652 rows=8,336 loops=1)

  • Hash Cond: (d_1.publisher_orgref = publisher_1.swa_org_ref)
29. 282.942 329.675 ↑ 15.3 8,337 1

Bitmap Heap Scan on entity d_1 (cost=416,582.44..1,072,901.48 rows=127,491 width=305) (actual time=53.001..329.675 rows=8,337 loops=1)

  • Recheck Cond: (entity_type > 1)
  • Rows Removed by Index Recheck: 5618
  • 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: 373635
  • Heap Blocks: exact=37090 lossy=34477
30. 46.733 46.733 ↑ 1.1 217,844 1

Bitmap Index Scan on idx_entity_type_active (cost=0.00..416,550.57 rows=240,627 width=0) (actual time=46.733..46.733 rows=217,844 loops=1)

  • Index Cond: ((entity_type > 1) AND (active = true))
31. 0.384 0.780 ↑ 1.0 1,309 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
32. 0.396 0.396 ↑ 1.0 1,309 1

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

33. 0.383 0.811 ↑ 1.0 1,309 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 82kB
34. 0.428 0.428 ↑ 1.0 1,309 1

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

35. 0.003 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
36. 0.008 0.008 ↑ 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.008 rows=5 loops=1)

37. 0.026 0.119 ↓ 8.5 93 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
38. 0.093 0.093 ↓ 8.5 93 1

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

39. 0.119 0.235 ↑ 5.2 437 1

Hash (cost=32.60..32.60 rows=2,260 width=8) (actual time=0.235..0.235 rows=437 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 50kB
40. 0.116 0.116 ↑ 5.2 437 1

Seq Scan on organisation_extended_funcs oef (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.006..0.116 rows=437 loops=1)

41. 1,427.913 1,427.913 ↑ 138.5 10,040 1

CTE Scan on entities (cost=0.00..27,815.14 rows=1,390,757 width=1,072) (actual time=55.198..1,427.913 rows=10,040 loops=1)

42. 0.011 0.033 ↓ 31.0 31 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
43. 0.022 0.022 ↓ 31.0 31 1

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

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