explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Xnxc

Settings
# exclusive inclusive rows x rows loops node
1. 0.696 396.315 ↑ 181.7 1,260 1

Hash Right Join (cost=14,671.20..20,307.25 rows=228,920 width=482) (actual time=395.556..396.315 rows=1,260 loops=1)

  • Hash Cond: ((sh1.sensor_id)::text = (s.sensor_id)::text)
2. 0.009 394.106 ↑ 75,927.0 6 1

Nested Loop (cost=13,842.42..15,480.95 rows=455,562 width=35) (actual time=394.023..394.106 rows=6 loops=1)

3. 220.243 393.961 ↑ 50.0 4 1

HashAggregate (cost=13,842.42..13,844.42 rows=200 width=39) (actual time=393.956..393.961 rows=4 loops=1)

  • Group Key: sensorhistory.sensor_id
4. 47.222 173.718 ↑ 1.0 455,561 1

Append (cost=0.00..11,564.61 rows=455,562 width=39) (actual time=0.004..173.718 rows=455,561 loops=1)

5. 0.000 0.000 ↓ 0.0 0 1

Seq Scan on sensorhistory (cost=0.00..0.00 rows=1 width=524) (actual time=0.000..0.000 rows=0 loops=1)

6. 126.496 126.496 ↑ 1.0 455,561 1

Seq Scan on sensorhistory_0 (cost=0.00..11,564.61 rows=455,561 width=39) (actual time=0.004..126.496 rows=455,561 loops=1)

7. 0.092 0.136 ↑ 1.5 2 4

Append (cost=0.00..8.14 rows=3 width=205) (actual time=0.032..0.034 rows=2 loops=4)

8. 0.000 0.000 ↓ 0.0 0 4

Seq Scan on sensorhistory sh1 (cost=0.00..0.00 rows=1 width=528) (actual time=0.000..0.000 rows=0 loops=4)

  • Filter: ((max(sensorhistory.actiontime)) = actiontime)
9. 0.044 0.044 ↑ 1.0 2 4

Index Scan using sensoryhistory_0_actiontime_ix on sensorhistory_0 sh1_1 (cost=0.42..8.14 rows=2 width=43) (actual time=0.009..0.011 rows=2 loops=4)

  • Index Cond: (actiontime = (max(sensorhistory.actiontime)))
10. 0.522 1.513 ↓ 2.1 1,258 1

Hash (cost=821.22..821.22 rows=605 width=478) (actual time=1.513..1.513 rows=1,258 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 162kB
11. 0.419 0.991 ↓ 2.1 1,258 1

Hash Right Join (cost=47.09..821.22 rows=605 width=478) (actual time=0.598..0.991 rows=1,258 loops=1)

  • Hash Cond: (smch.sensor_id = (s.sensor_id)::text)
  • Filter: ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (smch.mch_id IS NULL))
  • Rows Removed by Filter: 7
12. 0.010 0.010 ↑ 7.9 65 1

Seq Scan on sensormch smch (cost=0.00..20.30 rows=515 width=49) (actual time=0.002..0.010 rows=65 loops=1)

  • Filter: (NOT isdeleted)
13. 0.302 0.555 ↑ 1.0 1,204 1

Hash (cost=32.04..32.04 rows=1,204 width=429) (actual time=0.555..0.555 rows=1,204 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 149kB
14. 0.253 0.253 ↑ 1.0 1,204 1

Seq Scan on sensor s (cost=0.00..32.04 rows=1,204 width=429) (actual time=0.005..0.253 rows=1,204 loops=1)

  • Filter: (NOT isdeleted)
15.          

SubPlan (for Hash Right Join)

16. 0.000 0.000 ↓ 0.0 0

Seq Scan on ndmediachannel nd (cost=0.00..1.45 rows=1 width=0) (never executed)

  • Filter: ((NOT isdeleted) AND (smch.mch_id = ndmediachannel_id))
17. 0.007 0.007 ↑ 1.1 17 1

Seq Scan on ndmediachannel nd_1 (cost=0.00..1.36 rows=18 width=8) (actual time=0.003..0.007 rows=17 loops=1)

  • Filter: (NOT isdeleted)
  • Rows Removed by Filter: 19
Planning time : 1.095 ms
Execution time : 396.879 ms