explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JcsW

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 1,581.721 ↓ 0.0 0 1

Append (cost=3,425.28..7,207,242.80 rows=2 width=1,046) (actual time=1,581.721..1,581.721 rows=0 loops=1)

2. 0.001 16.249 ↓ 0.0 0 1

Subquery Scan on *SELECT* 1 (cost=3,425.28..32,629.77 rows=1 width=720) (actual time=16.249..16.249 rows=0 loops=1)

3. 0.001 16.248 ↓ 0.0 0 1

Nested Loop (cost=3,425.28..32,629.75 rows=1 width=716) (actual time=16.248..16.248 rows=0 loops=1)

4. 0.000 16.247 ↓ 0.0 0 1

Nested Loop (cost=3,425.13..32,620.26 rows=1 width=405) (actual time=16.247..16.247 rows=0 loops=1)

5. 0.002 16.247 ↓ 0.0 0 1

Nested Loop (cost=3,424.85..32,611.95 rows=1 width=383) (actual time=16.246..16.247 rows=0 loops=1)

6. 9.011 16.245 ↓ 0.0 0 1

Bitmap Heap Scan on entity_eton_agg d (cost=3,424.57..32,603.64 rows=1 width=361) (actual time=16.245..16.245 rows=0 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 AND (location_point_lon >= '-4.21875'::double precision) AND (location_point_lon <= '-2.8125'::double precision) AND (location_point_lat >= '45'::double precision) AND (location_point_lat <= '46.40625'::double precision))
  • Rows Removed by Filter: 8849
  • Heap Blocks: exact=5422
7. 7.234 7.234 ↑ 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.234..7.234 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.000 0.000 ↓ 0.0 0

Index Scan using pk_orgref on orgref publisher (cost=0.28..8.29 rows=1 width=26) (never executed)

  • Index Cond: (swa_org_ref = d.publisher_orgref)
9. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_orgref on orgref resporg (cost=0.28..8.29 rows=1 width=26) (never executed)

  • Index Cond: (swa_org_ref = d.responsible_org_orgref)
10. 0.000 0.000 ↓ 0.0 0

Index Scan using eton_impact_pkey on eton_impact ei (cost=0.15..8.17 rows=1 width=92) (never executed)

  • Index Cond: (impact_score = d.impact_score)
11. 0.001 1,565.470 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=7,130,088.81..7,174,613.03 rows=1 width=1,046) (actual time=1,565.470..1,565.470 rows=0 loops=1)

12. 0.024 1,565.469 ↓ 0.0 0 1

Nested Loop (cost=7,130,088.81..7,174,613.02 rows=1 width=1,072) (actual time=1,565.469..1,565.469 rows=0 loops=1)

  • Join Filter: ((entities.entity_category)::text = (ecat.nsa_code)::text)
13.          

CTE live_orgs

14. 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.020..0.045 rows=93 loops=1)

  • Recheck Cond: (extended_function_id = 14)
  • Heap Blocks: exact=3
15. 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)
16.          

CTE entities

17. 1,049.384 1,406.604 ↑ 147.8 10,041 1

Hash Left Join (cost=417,304.51..7,130,073.77 rows=1,483,775 width=647) (actual time=56.532..1,406.604 rows=10,041 loops=1)

  • Hash Cond: (d_1.publisher_organisation_id = oef.organisation_id)
18. 6.570 356.979 ↑ 16.3 8,336 1

Hash Left Join (cost=417,243.66..1,107,925.10 rows=136,018 width=437) (actual time=55.962..356.979 rows=8,336 loops=1)

  • Hash Cond: (d_1.publisher_organisation_id = live_orgs.organisation_id)
19. 7.065 350.288 ↑ 16.3 8,336 1

Hash Join (cost=417,243.30..1,107,342.46 rows=136,018 width=437) (actual time=55.828..350.288 rows=8,336 loops=1)

  • Hash Cond: (d_1.impact_score = ei_1.impact_score)
20. 7.519 343.213 ↑ 16.3 8,336 1

Hash Join (cost=417,225.65..1,106,963.31 rows=136,018 width=349) (actual time=55.806..343.213 rows=8,336 loops=1)

  • Hash Cond: (d_1.responsible_org_orgref = resporg_1.swa_org_ref)
21. 9.494 334.878 ↑ 16.3 8,337 1

Hash Join (cost=417,173.20..1,106,552.66 rows=136,018 width=327) (actual time=54.982..334.878 rows=8,337 loops=1)

  • Hash Cond: (d_1.publisher_orgref = publisher_1.swa_org_ref)
22. 276.702 324.606 ↑ 16.3 8,338 1

Bitmap Heap Scan on entity d_1 (cost=417,120.74..1,106,142.00 rows=136,018 width=305) (actual time=54.196..324.606 rows=8,338 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: 373626
  • Heap Blocks: exact=37089 lossy=34477
23. 47.904 47.904 ↑ 1.2 217,843 1

Bitmap Index Scan on idx_entity_type_active (cost=0.00..417,086.74 rows=256,742 width=0) (actual time=47.904..47.904 rows=217,843 loops=1)

  • Index Cond: ((entity_type > 1) AND (active = true))
24. 0.386 0.778 ↑ 1.0 1,309 1

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

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

26. 0.387 0.816 ↑ 1.0 1,309 1

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

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

28. 0.005 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
29. 0.005 0.005 ↑ 68.0 5 1

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

30. 0.027 0.121 ↓ 8.5 93 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
31. 0.094 0.094 ↓ 8.5 93 1

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

32. 0.124 0.241 ↑ 5.2 437 1

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

  • Buckets: 4096 Batches: 1 Memory Usage: 50kB
33. 0.117 0.117 ↑ 5.2 437 1

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

34. 0.038 0.038 ↓ 31.0 31 1

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

  • Filter: ((entitygroupid)::text = 'RW'::text)
  • Rows Removed by Filter: 61
35. 1,565.407 1,565.407 ↓ 0.0 0 31

CTE Scan on entities (cost=0.00..44,513.25 rows=37 width=1,072) (actual time=50.497..50.497 rows=0 loops=31)

  • Filter: ((lon >= '-4.21875'::double precision) AND (lon <= '-2.8125'::double precision) AND (lat >= '45'::double precision) AND (lat <= '46.40625'::double precision))
  • Rows Removed by Filter: 10041