explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vq2o : Optimization for: plan #XgPX

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 42.545 358.994 ↑ 10.1 32 1

HashAggregate (cost=51,592.09..51,597.74 rows=323 width=29) (actual time=358.981..358.994 rows=32 loops=1)

  • Group Key: rtrd.road_damage_value
2.          

Initplan (for HashAggregate)

3. 11.319 52.977 ↑ 1.0 1 1

Aggregate (cost=7,518.63..7,518.64 rows=1 width=8) (actual time=52.977..52.977 rows=1 loops=1)

4. 41.658 41.658 ↓ 1.0 128,699 1

Seq Scan on records r_1 (cost=0.00..7,197.64 rows=128,397 width=4) (actual time=0.006..41.658 rows=128,699 loops=1)

  • Filter: (is_latest_until IS NULL)
  • Rows Removed by Filter: 39047
5. 0.011 0.011 ↑ 1.0 1 1

Seq Scan on road_damage_types rdt (cost=0.00..1.18 rows=1 width=4) (actual time=0.010..0.011 rows=1 loops=1)

  • Filter: ((road_damage_type_name)::text = 'road_seams'::text)
  • Rows Removed by Filter: 13
6. 57.928 263.461 ↑ 1.0 128,184 1

Merge Join (cost=0.92..42,754.30 rows=131,797 width=9) (actual time=2.013..263.461 rows=128,184 loops=1)

  • Merge Cond: (rtrd.record_data_id = r.record_data_id)
7. 135.271 135.271 ↑ 1.0 167,146 1

Index Scan using records_to_road_damage_pkey on records_to_road_damage rtrd (cost=0.43..31,830.71 rows=172,104 width=9) (actual time=2.003..135.271 rows=167,146 loops=1)

  • Index Cond: (road_damage_type_id = $1)
8. 70.262 70.262 ↓ 1.0 128,699 1

Index Scan using records_pkey on records r (cost=0.42..8,967.34 rows=128,397 width=4) (actual time=0.008..70.262 rows=128,699 loops=1)

  • Filter: (is_latest_until IS NULL)
  • Rows Removed by Filter: 39047
Planning time : 4.825 ms
Execution time : 359.072 ms