explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wwgV : Optimization for: plan #Xcpc

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 49.172 1,018.457 ↓ 9.5 105 1

Unique (cost=35,514.93..35,514.99 rows=11 width=16) (actual time=886.514..1,018.457 rows=105 loops=1)

2. 367.756 969.285 ↓ 65,960.5 725,565 1

Sort (cost=35,514.93..35,514.96 rows=11 width=16) (actual time=886.513..969.285 rows=725,565 loops=1)

  • Sort Key: h.sensor_id, h.received_at DESC
  • Sort Method: external merge Disk: 18,512kB
3. 5.620 601.529 ↓ 65,960.5 725,565 1

Gather (cost=1,104.80..35,514.74 rows=11 width=16) (actual time=13.335..601.529 rows=725,565 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
4. 447.796 595.909 ↓ 48,371.0 241,855 3 / 3

Hash Join (cost=104.80..34,513.64 rows=5 width=16) (actual time=9.699..595.909 rows=241,855 loops=3)

  • Hash Cond: (ls.line_id = il.line_id)
  • Join Filter: (h.received_at <@ il.connected)
  • Rows Removed by Join Filter: 3,950,550
5. 89.617 146.963 ↓ 798.5 274,701 3 / 3

Hash Join (cost=9.05..34,234.43 rows=344 width=20) (actual time=8.520..146.963 rows=274,701 loops=3)

  • Hash Cond: (h.sensor_id = ls.sensor_id)
  • Join Filter: (h.received_at <@ ls.connected)
  • Rows Removed by Join Filter: 388
6. 57.192 57.192 ↑ 1.2 275,090 3 / 3

Parallel Seq Scan on heartbeats h (cost=0.00..28,637.62 rows=343,862 width=16) (actual time=8.171..57.192 rows=275,090 loops=3)

  • Filter: (sensor_id IS NOT NULL)
7. 0.066 0.154 ↑ 1.0 269 3 / 3

Hash (cost=5.69..5.69 rows=269 width=24) (actual time=0.153..0.154 rows=269 loops=3)

  • Buckets: 1,024 Batches: 1 Memory Usage: 24kB
8. 0.088 0.088 ↑ 1.0 269 3 / 3

Seq Scan on line_sensors ls (cost=0.00..5.69 rows=269 width=24) (actual time=0.039..0.088 rows=269 loops=3)

9. 0.501 1.150 ↓ 1.1 2,715 3 / 3

Hash (cost=63.59..63.59 rows=2,573 width=25) (actual time=1.150..1.150 rows=2,715 loops=3)

  • Buckets: 4,096 Batches: 1 Memory Usage: 190kB
10. 0.649 0.649 ↓ 1.1 2,715 3 / 3

Seq Scan on item_lines il (cost=0.00..63.59 rows=2,573 width=25) (actual time=0.024..0.649 rows=2,715 loops=3)

  • Filter: ((connected_to IS NOT NULL) OR (queue_index = '0'::double precision))
  • Rows Removed by Filter: 52
Planning time : 1.650 ms
Execution time : 1,020.160 ms