explain.depesz.com

PostgreSQL's explain analyze made readable

Result: X4bq

Settings
# exclusive inclusive rows x rows loops node
1. 0.252 2,182.925 ↓ 54.0 216 1

Sort (cost=262,152.89..262,152.90 rows=4 width=84) (actual time=2,182.910..2,182.925 rows=216 loops=1)

  • Sort Key: ndalarmhistory_v2.ndalarm_id, ndalarmhistory_v2.action
  • Sort Method: quicksort Memory: 55kB
2. 0.134 2,182.673 ↓ 54.0 216 1

Hash Left Join (cost=253,478.80..262,152.85 rows=4 width=84) (actual time=2,177.481..2,182.673 rows=216 loops=1)

  • Hash Cond: (ndalarmhistory_v2.ndalarm_id = fn_ndalarmhistory.prmndalarmid)
3. 0.097 2,110.886 ↓ 108.0 216 1

Nested Loop (cost=253,456.05..262,129.80 rows=2 width=52) (actual time=2,105.807..2,110.886 rows=216 loops=1)

4. 850.615 2,105.844 ↑ 2.3 215 1

HashAggregate (cost=253,456.05..253,461.05 rows=500 width=20) (actual time=2,105.746..2,105.844 rows=215 loops=1)

  • Group Key: ndalarmhistory_v2_1.ndalarm_id, ndalarmhistory_v2_1.action
5. 182.056 1,255.229 ↑ 1.0 1,950,094 1

Append (cost=0.00..238,672.77 rows=1,971,105 width=20) (actual time=386.360..1,255.229 rows=1,950,094 loops=1)

6. 0.001 0.001 ↓ 0.0 0 1

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

  • Filter: (ndalarm_id = ANY ('{8,80,16,54,47,99,46,48,28,83,94,36,15,77,4,30,73,95,40,56,53,62,92,23,20,44,82,25,58,1,26,86,13,49,22,91,70,45,27,60,93,21,97}'::bigint[]))
7. 713.009 1,073.046 ↑ 1.0 1,950,094 1

Bitmap Heap Scan on ndalarmhistory_v2_0 ndalarmhistory_v2_0_1 (cost=38,398.82..238,437.58 rows=1,971,102 width=20) (actual time=386.358..1,073.046 rows=1,950,094 loops=1)

  • Recheck Cond: (ndalarm_id = ANY ('{8,80,16,54,47,99,46,48,28,83,94,36,15,77,4,30,73,95,40,56,53,62,92,23,20,44,82,25,58,1,26,86,13,49,22,91,70,45,27,60,93,21,97}'::bigint[]))
  • Heap Blocks: exact=66932
8. 360.037 360.037 ↑ 1.0 1,950,098 1

Bitmap Index Scan on ndalarmhistory_v2_0_ndalarm_id_fkey_ix (cost=0.00..37,906.05 rows=1,971,102 width=0) (actual time=360.037..360.037 rows=1,950,098 loops=1)

  • Index Cond: (ndalarm_id = ANY ('{8,80,16,54,47,99,46,48,28,83,94,36,15,77,4,30,73,95,40,56,53,62,92,23,20,44,82,25,58,1,26,86,13,49,22,91,70,45,27,60,93,21,97}'::bigint[]))
9. 0.079 0.079 ↓ 0.0 0 1

Index Scan using ndalarmhistory_v2_5000000_ndalarm_id_fkey_ix on ndalarmhistory_v2_5000000 ndalarmhistory_v2_5000000_1 (cost=0.48..194.98 rows=1 width=20) (actual time=0.079..0.079 rows=0 loops=1)

  • Index Cond: (ndalarm_id = ANY ('{8,80,16,54,47,99,46,48,28,83,94,36,15,77,4,30,73,95,40,56,53,62,92,23,20,44,82,25,58,1,26,86,13,49,22,91,70,45,27,60,93,21,97}'::bigint[]))
10. 0.047 0.047 ↓ 0.0 0 1

Index Scan using ndalarmhistory_v2_10000000_ndalarm_id_fkey_ix on ndalarmhistory_v2_10000000 ndalarmhistory_v2_10000000_1 (cost=0.33..40.21 rows=1 width=20) (actual time=0.047..0.047 rows=0 loops=1)

  • Index Cond: (ndalarm_id = ANY ('{8,80,16,54,47,99,46,48,28,83,94,36,15,77,4,30,73,95,40,56,53,62,92,23,20,44,82,25,58,1,26,86,13,49,22,91,70,45,27,60,93,21,97}'::bigint[]))
11. 2.795 4.945 ↑ 4.0 1 215

Append (cost=0.00..17.29 rows=4 width=86) (actual time=0.018..0.023 rows=1 loops=215)

12. 0.000 0.000 ↓ 0.0 0 215

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

  • Filter: ((ndalarmhistory_v2_1.action = action) AND ((max(ndalarmhistory_v2_1.actiontime)) = actiontime))
13. 1.290 1.290 ↑ 1.0 1 215

Index Scan using ndalarmhistory_v2_0_actionime_ix on ndalarmhistory_v2_0 (cost=0.43..8.40 rows=1 width=51) (actual time=0.005..0.006 rows=1 loops=215)

  • Index Cond: (actiontime = (max(ndalarmhistory_v2_1.actiontime)))
  • Filter: (ndalarmhistory_v2_1.action = action)
14. 0.645 0.645 ↓ 0.0 0 215

Index Scan using ndalarmhistory_v2_5000000_actionime_ix on ndalarmhistory_v2_5000000 (cost=0.43..8.40 rows=1 width=54) (actual time=0.003..0.003 rows=0 loops=215)

  • Index Cond: (actiontime = (max(ndalarmhistory_v2_1.actiontime)))
  • Filter: (ndalarmhistory_v2_1.action = action)
15. 0.215 0.215 ↓ 0.0 0 215

Index Scan using ndalarmhistory_v2_10000000_actionime_ix on ndalarmhistory_v2_10000000 (cost=0.28..0.49 rows=1 width=121) (actual time=0.001..0.001 rows=0 loops=215)

  • Index Cond: (actiontime = (max(ndalarmhistory_v2_1.actiontime)))
  • Filter: (ndalarmhistory_v2_1.action = action)
16. 0.033 71.653 ↑ 10.0 100 1

Hash (cost=10.25..10.25 rows=1,000 width=40) (actual time=71.653..71.653 rows=100 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
17. 71.620 71.620 ↑ 10.0 100 1

Function Scan on fn_ndalarmhistory (cost=0.25..10.25 rows=1,000 width=40) (actual time=71.602..71.620 rows=100 loops=1)

Planning time : 1.753 ms
Execution time : 2,184.419 ms