explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kzsG

Settings
# exclusive inclusive rows x rows loops node
1. 6.883 25,753.716 ↑ 1.0 1 1

Aggregate (cost=39,937.53..39,937.54 rows=1 width=32) (actual time=25,753.716..25,753.716 rows=1 loops=1)

2. 1.185 25,746.833 ↑ 12.5 417 1

Subquery Scan on q (cost=39,506.55..39,924.47 rows=5,224 width=100) (actual time=15,229.621..25,746.833 rows=417 loops=1)

3. 9,660.493 25,745.648 ↑ 12.5 417 1

GroupAggregate (cost=39,506.55..39,872.23 rows=5,224 width=100) (actual time=15,229.600..25,745.648 rows=417 loops=1)

  • Group Key: s.link_id, v_transit_roads.street_name, ((v_transit_roads.road_speed)::smallint), ((v_transit_roads.road_rank)::smallint), v_transit_roads.truck, v_transit_roads.surface, ((v_transit_roads.road_km)::real), ((round(sum((v_transit_roads.trailer_loads)::numeric), 2))::real), ((round(sum((v_transit_roads.tonnes)::numeric), 2))::real), ((round(avg((v_transit_roads.tonnes_per_trailer)::numeric), 2))::real), ((round(sum((v_transit_roads.trip_transport_costs)::numeric), 2))::real), (st_asmvtgeom(v_transit_roads.geometry, 'BOX(16750104.6279688 -3287403.71203125,16906647.661875 -3130860.678125)'::box2d, 4096, 1024, true))
4.          

CTE boundaries

5. 0.000 0.000 ↓ 0.0 0

Seq Scan on v_transit_boundaries (cost=0.00..910.46 rows=3,346 width=75,373) (never executed)

6. 9,354.679 16,085.155 ↓ 731.1 3,819,120 1

Sort (cost=38,596.09..38,609.15 rows=5,224 width=92) (actual time=15,225.327..16,085.155 rows=3,819,120 loops=1)

  • Sort Key: s.link_id, v_transit_roads.street_name, ((v_transit_roads.road_speed)::smallint), ((v_transit_roads.road_rank)::smallint), v_transit_roads.truck, v_transit_roads.surface, ((v_transit_roads.road_km)::real), ((round(sum((v_transit_roads.trailer_loads)::numeric), 2))::real), ((round(sum((v_transit_roads.tonnes)::numeric), 2))::real), ((round(avg((v_transit_roads.tonnes_per_trailer)::numeric), 2))::real), ((round(sum((v_transit_roads.trip_transport_costs)::numeric), 2))::real), (st_asmvtgeom(v_transit_roads.geometry, 'BOX(16750104.6279688 -3287403.71203125,16906647.661875 -3130860.678125)'::box2d, 4096, 1024, true))
  • Sort Method: quicksort Memory: 1089242kB
7. 1,977.912 6,730.476 ↓ 731.1 3,819,120 1

Hash Join (cost=533.15..38,273.48 rows=5,224 width=92) (actual time=4,546.658..6,730.476 rows=3,819,120 loops=1)

  • Hash Cond: (road_movements.trip_id = s.trip_id)
8. 235.360 235.360 ↑ 1.0 582,725 1

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

9. 2,086.029 4,517.204 ↓ 731.1 3,819,120 1

Hash (cost=467.85..467.85 rows=5,224 width=92) (actual time=4,517.203..4,517.204 rows=3,819,120 loops=1)

  • Buckets: 4194304 (originally 8192) Batches: 1 (originally 1) Memory Usage: 654247kB
10. 762.177 2,431.175 ↓ 731.1 3,819,120 1

Nested Loop (cost=180.08..467.85 rows=5,224 width=92) (actual time=2.906..2,431.175 rows=3,819,120 loops=1)

11. 11.293 14.342 ↓ 417.0 417 1

GroupAggregate (cost=179.50..179.60 rows=1 width=246) (actual time=2.872..14.342 rows=417 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
12. 0.552 3.049 ↓ 417.0 417 1

Sort (cost=179.50..179.51 rows=1 width=206) (actual time=2.823..3.049 rows=417 loops=1)

  • Sort 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
  • Sort Method: quicksort Memory: 145kB
13. 0.237 2.497 ↓ 417.0 417 1

Nested Loop Left Join (cost=0.42..179.49 rows=1 width=206) (actual time=0.136..2.497 rows=417 loops=1)

  • Join Filter: NULL::boolean
14. 2.260 2.260 ↓ 417.0 417 1

Index Scan using idx_v_transit_roads_street_name on v_transit_roads (cost=0.42..179.48 rows=1 width=206) (actual time=0.132..2.260 rows=417 loops=1)

  • Index Cond: ((street_name)::text = ANY ('{"Gore Hwy"}'::text[]))
  • Filter: ((geometry && '0103000020110F00000100000005000000EC511814C3F26F41CDCCCC56F6E247C1EC511814C3F26F410AD723DBB51449C13D0A977A991F70410AD723DBB51449C13D0A977A991F7041CDCCCC56F6E247C1EC511814C3F26F41CDCCCC56F6E247C1'::geometry) AND _st_intersects(geometry, '0103000020110F00000100000005000000EC511814C3F26F41CDCCCC56F6E247C1EC511814C3F26F410AD723DBB51449C13D0A977A991F70410AD723DBB51449C13D0A977A991F7041CDCCCC56F6E247C1EC511814C3F26F41CDCCCC56F6E247C1'::geometry))
  • Rows Removed by Filter: 32
15. 0.000 0.000 ↓ 0.0 0 417

Result (cost=0.00..0.00 rows=0 width=0) (actual time=0.000..0.000 rows=0 loops=417)

  • One-Time Filter: false
16. 1,654.656 1,654.656 ↓ 1.8 9,159 417

Index Only Scan using idx_road_segments_key on road_segments s (cost=0.57..236.00 rows=5,224 width=16) (actual time=0.019..3.968 rows=9,159 loops=417)

  • Index Cond: (link_id = ((v_transit_roads.link_id)::integer))
  • Heap Fetches: 0
Planning time : 10.007 ms