explain.depesz.com

PostgreSQL's explain analyze made readable

Result: eD0D

Settings
# exclusive inclusive rows x rows loops node
1. 6.798 5,372.490 ↓ 1,217.0 2,434 1

Sort (cost=487,574.34..487,574.35 rows=2 width=52) (actual time=5,372.415..5,372.490 rows=2,434 loops=1)

  • Sort Key: ndalarmhistory_v2.name, ndalarmhistory_v2.action
  • Sort Method: quicksort Memory: 434kB
2. 1.620 5,365.692 ↓ 1,217.0 2,434 1

Nested Loop (cost=479,208.15..487,574.33 rows=2 width=52) (actual time=5,138.466..5,365.692 rows=2,434 loops=1)

3. 60.441 5,342.175 ↓ 4.9 2,433 1

Hash Semi Join (cost=479,208.15..479,236.33 rows=500 width=12) (actual time=5,138.423..5,342.175 rows=2,433 loops=1)

  • Hash Cond: (ndalarmhistory_v2_1.name = ndalarmhistory_v2_2.name)
4. 2,124.955 3,727.215 ↓ 702.6 702,564 1

HashAggregate (cost=334,803.90..334,813.90 rows=1,000 width=39) (actual time=3,531.040..3,727.215 rows=702,564 loops=1)

  • Group Key: ndalarmhistory_v2_1.name, ndalarmhistory_v2_1.action
5. 396.643 1,602.260 ↑ 1.0 9,834,005 1

Append (cost=0.00..258,303.94 rows=10,199,995 width=39) (actual time=0.003..1,602.260 rows=9,834,005 loops=1)

6. 0.000 0.000 ↓ 0.0 0 1

Seq Scan on ndalarmhistory_v2 ndalarmhistory_v2_1 (cost=0.00..0.00 rows=1 width=44) (actual time=0.000..0.000 rows=0 loops=1)

7. 605.869 605.869 ↑ 1.0 4,970,001 1

Seq Scan on ndalarmhistory_v2_0 ndalarmhistory_v2_0_1 (cost=0.00..126,407.91 rows=5,202,691 width=44) (actual time=0.003..605.869 rows=4,970,001 loops=1)

8. 599.748 599.748 ↑ 1.0 4,864,004 1

Seq Scan on ndalarmhistory_v2_5000000 ndalarmhistory_v2_5000000_1 (cost=0.00..131,896.03 rows=4,997,303 width=33) (actual time=0.004..599.748 rows=4,864,004 loops=1)

9. 0.155 1,554.519 ↓ 5.0 1,000 1

Hash (cost=144,401.74..144,401.74 rows=200 width=21) (actual time=1,554.519..1,554.519 rows=1,000 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 52kB
10. 0.035 1,554.364 ↓ 5.0 1,000 1

Limit (cost=144,397.74..144,399.74 rows=200 width=21) (actual time=1,554.087..1,554.364 rows=1,000 loops=1)

11. 697.409 1,554.329 ↓ 5.0 1,000 1

HashAggregate (cost=144,397.74..144,399.74 rows=200 width=21) (actual time=1,554.086..1,554.329 rows=1,000 loops=1)

  • Group Key: ndalarmhistory_v2_2.name
12. 182.469 856.920 ↓ 1.1 5,264,004 1

Append (cost=0.00..131,904.48 rows=4,997,305 width=21) (actual time=0.019..856.920 rows=5,264,004 loops=1)

13. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on ndalarmhistory_v2 ndalarmhistory_v2_2 (cost=0.00..0.00 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: (name IS NOT NULL)
14. 58.275 58.275 ↓ 400,000.0 400,000 1

Index Only Scan using ndalarmhistory_v2_0_name_ix on ndalarmhistory_v2_0 ndalarmhistory_v2_0_2 (cost=0.43..8.45 rows=1 width=32) (actual time=0.017..58.275 rows=400,000 loops=1)

  • Index Cond: (name IS NOT NULL)
  • Heap Fetches: 400000
15. 616.175 616.175 ↑ 1.0 4,864,004 1

Seq Scan on ndalarmhistory_v2_5000000 ndalarmhistory_v2_5000000_2 (cost=0.00..131,896.03 rows=4,997,303 width=21) (actual time=0.005..616.175 rows=4,864,004 loops=1)

  • Filter: (name IS NOT NULL)
16. 9.732 21.897 ↑ 3.0 1 2,433

Append (cost=0.00..16.65 rows=3 width=71) (actual time=0.009..0.009 rows=1 loops=2,433)

17. 0.000 0.000 ↓ 0.0 0 2,433

Seq Scan on ndalarmhistory_v2 (cost=0.00..0.00 rows=1 width=108) (actual time=0.000..0.000 rows=0 loops=2,433)

  • Filter: ((ndalarmhistory_v2_1.action = action) AND ((max(ndalarmhistory_v2_1.actiontime)) = actiontime))
18. 2.433 2.433 ↓ 0.0 0 2,433

Index Scan using ndalarmhistory_v2_0_actionime_ix on ndalarmhistory_v2_0 (cost=0.43..8.32 rows=1 width=56) (actual time=0.001..0.001 rows=0 loops=2,433)

  • Index Cond: (actiontime = (max(ndalarmhistory_v2_1.actiontime)))
  • Filter: (ndalarmhistory_v2_1.action = action)
19. 9.732 9.732 ↑ 1.0 1 2,433

Index Scan using ndalarmhistory_v2_5000000_actionime_ix on ndalarmhistory_v2_5000000 (cost=0.43..8.32 rows=1 width=48) (actual time=0.004..0.004 rows=1 loops=2,433)

  • Index Cond: (actiontime = (max(ndalarmhistory_v2_1.actiontime)))
  • Filter: (ndalarmhistory_v2_1.action = action)
  • Rows Removed by Filter: 0
Planning time : 1.769 ms
Execution time : 5,385.725 ms