explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ptOP

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 2.490 ↑ 1.0 5 1

Limit (cost=877.59..877.61 rows=5 width=135) (actual time=2.486..2.490 rows=5 loops=1)

2. 0.163 2.490 ↑ 7.4 5 1

Sort (cost=877.59..877.69 rows=37 width=135) (actual time=2.486..2.490 rows=5 loops=1)

  • Sort Key: (CASE WHEN (a.ack_time IS NULL) THEN false ELSE true END), a.trigger_time DESC, a.name, devices.name
  • Sort Method: top-N heapsort Memory: 26kB
3. 0.312 2.327 ↓ 3.3 121 1

Nested Loop (cost=1.12..876.98 rows=37 width=135) (actual time=0.047..2.327 rows=121 loops=1)

  • Join Filter: (a.device_id = devices.id)
4. 0.442 1.652 ↓ 2.2 121 1

Nested Loop (cost=0.70..780.62 rows=56 width=105) (actual time=0.034..1.652 rows=121 loops=1)

5. 0.397 0.397 ↓ 3.0 271 1

Index Scan using idx_alarm_occurences_user on alarm_occurences a (cost=0.29..28.36 rows=91 width=101) (actual time=0.020..0.397 rows=271 loops=1)

  • Index Cond: (user_id = 102)
  • Filter: ((NOT is_deleted) OR (ack_time IS NULL))
  • Rows Removed by Filter: 1
6. 0.813 0.813 ↓ 0.0 0 271

Index Scan using idx_device_id on devices d (cost=0.41..8.26 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=271)

  • Index Cond: (id = a.device_id)
  • Filter: (company_id = 101)
  • Rows Removed by Filter: 1
7. 0.363 0.363 ↑ 1.0 1 121

Index Scan using idx_device_id on devices (cost=0.41..1.71 rows=1 width=38) (actual time=0.003..0.003 rows=1 loops=121)

  • Index Cond: (id = d.id)
  • Filter: (activation_status < 9999)