explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VAm5

Settings
# exclusive inclusive rows x rows loops node
1. 174.724 164,401.985 ↑ 1.0 1 1

Aggregate (cost=2,494,065.27..2,494,065.28 rows=1 width=32) (actual time=164,401.984..164,401.985 rows=1 loops=1)

2. 25.247 164,227.261 ↓ 4.2 30,066 1

Subquery Scan on q (cost=2,493,487.42..2,494,047.21 rows=7,223 width=44) (actual time=163,924.967..164,227.261 rows=30,066 loops=1)

3. 113,508.071 164,202.014 ↓ 4.2 30,066 1

HashAggregate (cost=2,493,487.42..2,493,974.98 rows=7,223 width=253) (actual time=163,924.920..164,202.014 rows=30,066 loops=1)

  • Group Key: v_transit_roads.link_id, v_transit_roads.street_name, v_transit_roads.road_speed, v_transit_roads.road_rank, v_transit_roads.truck, v_transit_roads.surface, v_transit_roads.road_km, v_transit_roads.geometry
4.          

CTE boundaries

5. 0.090 0.090 ↑ 1.0 1 1

Index Scan using idx_v_transit_boundaries_code on v_transit_boundaries (cost=0.28..8.30 rows=1 width=75,373) (actual time=0.087..0.090 rows=1 loops=1)

  • Index Cond: (code = ANY ('{LGA_33960}'::text[]))
6. 13,530.626 50,693.943 ↓ 3.9 19,374,368 1

Nested Loop Left Join (cost=40,634.50..2,234,880.09 rows=4,925,696 width=209) (actual time=776.434..50,693.943 rows=19,374,368 loops=1)

7. 15,727.590 37,163.317 ↓ 3.9 19,374,368 1

Hash Left Join (cost=40,634.50..2,136,366.16 rows=4,925,696 width=209) (actual time=776.334..37,163.317 rows=19,374,368 loops=1)

  • Hash Cond: (road_segments.trip_id = road_movements.trip_id)
8. 4,335.462 20,669.048 ↓ 3.9 19,374,368 1

Nested Loop (cost=761.19..2,083,562.80 rows=4,925,696 width=193) (actual time=7.741..20,669.048 rows=19,374,368 loops=1)

9. 392.071 398.606 ↓ 4.2 30,066 1

Bitmap Heap Scan on v_transit_roads (cost=760.62..34,129.40 rows=7,223 width=185) (actual time=7.334..398.606 rows=30,066 loops=1)

  • Recheck Cond: (geometry && '0103000020110F00000100000005000000E17ADC72B5327041CDCCCC56F6E247C1E17ADC72B5327041EC51F818D67B48C185EB216BD1457041EC51F818D67B48C185EB216BD1457041CDCCCC56F6E247C1E17ADC72B5327041CDCCCC56F6E247C1'::geometry)
  • Filter: _st_intersects(geometry, '0103000020110F00000100000005000000E17ADC72B5327041CDCCCC56F6E247C1E17ADC72B5327041EC51F818D67B48C185EB216BD1457041EC51F818D67B48C185EB216BD1457041CDCCCC56F6E247C1E17ADC72B5327041CDCCCC56F6E247C1'::geometry)
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=3969
10. 6.535 6.535 ↓ 1.4 30,067 1

Bitmap Index Scan on v_transit_roads_geometry_geom_idx (cost=0.00..758.81 rows=21,670 width=0) (actual time=6.535..6.535 rows=30,067 loops=1)

  • Index Cond: (geometry && '0103000020110F00000100000005000000E17ADC72B5327041CDCCCC56F6E247C1E17ADC72B5327041EC51F818D67B48C185EB216BD1457041EC51F818D67B48C185EB216BD1457041CDCCCC56F6E247C1E17ADC72B5327041CDCCCC56F6E247C1'::geometry)
11. 15,934.980 15,934.980 ↑ 8.1 644 30,066

Index Only Scan using idx_road_segments_key on road_segments (cost=0.57..231.50 rows=5,224 width=16) (actual time=0.010..0.530 rows=644 loops=30,066)

  • Index Cond: (link_id = v_transit_roads.link_id)
  • Heap Fetches: 0
12. 217.328 766.679 ↑ 1.0 582,725 1

Hash (cost=32,589.25..32,589.25 rows=582,725 width=32) (actual time=766.678..766.679 rows=582,725 loops=1)

  • Buckets: 1048576 Batches: 1 Memory Usage: 44613kB
13. 549.351 549.351 ↑ 1.0 582,725 1

Seq Scan on road_movements (cost=0.00..32,589.25 rows=582,725 width=32) (actual time=0.045..549.351 rows=582,725 loops=1)

14. 0.000 0.000 ↑ 1.0 1 19,374,368

CTE Scan on boundaries (cost=0.00..0.02 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=19,374,368)

Planning time : 41.824 ms