explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pvPT

Settings
# exclusive inclusive rows x rows loops node
1. 25,935.630 151,535.321 ↓ 0.0 0 1

Nested Loop (cost=3.10..5,499,482.06 rows=44,219,101 width=47) (actual time=151,535.321..151,535.321 rows=0 loops=1)

  • Join Filter: ((online.last_event_id < events.event_id) OR (online.last_event_id IS NULL))
  • Rows Removed by Join Filter: 129983772
2. 1,069.184 3,417.457 ↑ 1.0 2,599,622 1

Merge Join (cost=2.67..158,494.28 rows=2,599,622 width=22) (actual time=0.193..3,417.457 rows=2,599,622 loops=1)

  • Merge Cond: (online.account_db_id = friends.account_db_id)
3. 198.467 198.467 ↑ 1.0 99,999 1

Index Scan using online_pkey on online (cost=0.42..8,407.78 rows=99,999 width=12) (actual time=0.168..198.467 rows=99,999 loops=1)

  • Index Cond: (account_db_id < 100000)
  • Filter: ((sent_at < (now() + '00:02:00'::interval)) OR (sent_at IS NULL))
4. 2,149.806 2,149.806 ↑ 1.0 2,599,648 1

Index Scan using friend_dbid on friends (cost=0.43..117,755.77 rows=2,599,648 width=18) (actual time=0.014..2,149.806 rows=2,599,648 loops=1)

5. 122,182.234 122,182.234 ↑ 1.0 50 2,599,622

Index Scan using events_account_db_id on events (cost=0.43..1.42 rows=51 width=33) (actual time=0.006..0.047 rows=50 loops=2,599,622)

  • Index Cond: (account_db_id = friends.friend_db_id)
Planning time : 6.176 ms
Execution time : 151,535.394 ms