explain.depesz.com

PostgreSQL's explain analyze made readable

Result: H3Sm

Settings
# exclusive inclusive rows x rows loops node
1. 0.487 5.850 ↓ 3.0 5,000 1

Subquery Scan on t (cost=480.23..630.23 rows=1,667 width=12) (actual time=2.487..5.850 rows=5,000 loops=1)

  • Filter: (t.rk <= 10)
2. 2.704 5.363 ↑ 1.0 5,000 1

WindowAgg (cost=480.23..567.73 rows=5,000 width=20) (actual time=2.486..5.363 rows=5,000 loops=1)

3. 1.075 2.659 ↑ 1.0 5,000 1

Sort (cost=480.23..492.73 rows=5,000 width=12) (actual time=2.465..2.659 rows=5,000 loops=1)

  • Sort Key: (COALESCE(friend_video.rank, '0'::bigint)) DESC
  • Sort Method: quicksort Memory: 427kB
4. 0.674 1.584 ↑ 1.0 5,000 1

Hash Left Join (cost=76.90..173.04 rows=5,000 width=12) (actual time=0.505..1.584 rows=5,000 loops=1)

  • Hash Cond: (v.video_id = friend_video.vid)
5. 0.437 0.437 ↑ 1.0 5,000 1

Seq Scan on video v (cost=0.00..83.00 rows=5,000 width=4) (actual time=0.021..0.437 rows=5,000 loops=1)

6. 0.016 0.473 ↑ 1.6 7 1

Hash (cost=76.77..76.77 rows=11 width=12) (actual time=0.473..0.473 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
7. 0.001 0.457 ↑ 1.6 7 1

Subquery Scan on friend_video (cost=76.46..76.77 rows=11 width=12) (actual time=0.455..0.457 rows=7 loops=1)

8. 0.011 0.456 ↑ 1.6 7 1

GroupAggregate (cost=76.46..76.66 rows=11 width=12) (actual time=0.454..0.456 rows=7 loops=1)

  • Group Key: l.video_id
9. 0.006 0.445 ↑ 1.6 7 1

Sort (cost=76.46..76.49 rows=11 width=4) (actual time=0.444..0.445 rows=7 loops=1)

  • Sort Key: l.video_id
  • Sort Method: quicksort Memory: 25kB
10. 0.005 0.439 ↑ 1.6 7 1

Nested Loop Anti Join (cost=17.11..76.27 rows=11 width=4) (actual time=0.414..0.439 rows=7 loops=1)

11. 0.006 0.420 ↑ 1.6 7 1

Nested Loop Anti Join (cost=16.69..70.95 rows=11 width=4) (actual time=0.404..0.420 rows=7 loops=1)

12. 0.017 0.309 ↑ 1.6 7 1

Nested Loop (cost=16.41..67.60 rows=11 width=4) (actual time=0.301..0.309 rows=7 loops=1)

13. 0.004 0.154 ↑ 2.0 1 1

Unique (cost=11.94..11.95 rows=2 width=4) (actual time=0.153..0.154 rows=1 loops=1)

14. 0.011 0.150 ↑ 2.0 1 1

Sort (cost=11.94..11.94 rows=2 width=4) (actual time=0.150..0.150 rows=1 loops=1)

  • Sort Key: f.friend_id
  • Sort Method: quicksort Memory: 25kB
15. 0.005 0.139 ↑ 2.0 1 1

Bitmap Heap Scan on friend f (cost=4.31..11.93 rows=2 width=4) (actual time=0.139..0.139 rows=1 loops=1)

  • Recheck Cond: (user_id = 1)
  • Heap Blocks: exact=1
16. 0.134 0.134 ↑ 2.0 1 1

Bitmap Index Scan on friend_index (cost=0.00..4.31 rows=2 width=0) (actual time=0.134..0.134 rows=1 loops=1)

  • Index Cond: (user_id = 1)
17. 0.012 0.138 ↓ 1.2 7 1

Bitmap Heap Scan on likes l (cost=4.47..27.76 rows=6 width=8) (actual time=0.131..0.138 rows=7 loops=1)

  • Recheck Cond: (user_id = f.friend_id)
  • Heap Blocks: exact=7
18. 0.126 0.126 ↓ 1.2 7 1

Bitmap Index Scan on likes_index (cost=0.00..4.47 rows=6 width=0) (actual time=0.126..0.126 rows=7 loops=1)

  • Index Cond: (user_id = f.friend_id)
19. 0.105 0.105 ↓ 0.0 0 7

Index Only Scan using watch_index on watch w (cost=0.28..0.30 rows=1 width=4) (actual time=0.015..0.015 rows=0 loops=7)

  • Index Cond: ((user_id = 1) AND (video_id = l.video_id))
  • Heap Fetches: 0
20. 0.014 0.014 ↓ 0.0 0 7

Index Only Scan using likes_index on likes l_user (cost=0.42..0.48 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=7)

  • Index Cond: ((user_id = 1) AND (video_id = l.video_id))
  • Heap Fetches: 0