explain.depesz.com

PostgreSQL's explain analyze made readable

Result: K6q0

Settings
# exclusive inclusive rows x rows loops node
1. 0.192 165.796 ↑ 181.7 1,260 1

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

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

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

3. 91.267 164.449 ↑ 50.0 4 1

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

  • Group Key: sensorhistory.sensor_id
4. 18.903 73.182 ↑ 1.0 455,561 1

Append (cost=0.00..11,564.61 rows=455,562 width=39) (actual time=0.003..73.182 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. 54.279 54.279 ↑ 1.0 455,561 1

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

7. 0.028 0.048 ↑ 1.5 2 4

Append (cost=0.00..8.14 rows=3 width=205) (actual time=0.012..0.012 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.020 0.020 ↑ 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.005..0.005 rows=2 loops=4)

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

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

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

Hash Right Join (cost=47.09..821.22 rows=605 width=478) (actual time=0.430..0.717 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.008 0.008 ↑ 7.9 65 1

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

  • Filter: (NOT isdeleted)
13. 0.218 0.404 ↑ 1.0 1,204 1

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

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

Seq Scan on sensor s (cost=0.00..32.04 rows=1,204 width=429) (actual time=0.004..0.186 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.005 0.005 ↑ 1.1 17 1

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

  • Filter: (NOT isdeleted)
  • Rows Removed by Filter: 19
Planning time : 0.633 ms
Execution time : 165.996 ms