explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uXcM

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 5.905 ↑ 1.0 10 1

Limit (cost=4,402.61..4,402.64 rows=10 width=12) (actual time=5.902..5.905 rows=10 loops=1)

  • Buffers: shared hit=2874
2. 0.284 5.903 ↑ 54.0 10 1

Sort (cost=4,402.61..4,403.96 rows=540 width=12) (actual time=5.902..5.903 rows=10 loops=1)

  • Sort Key: ((SubPlan 1)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=2874
3. 0.694 5.619 ↓ 2.2 1,200 1

HashAggregate (cost=16.75..4,390.94 rows=540 width=12) (actual time=0.359..5.619 rows=1,200 loops=1)

  • Group Key: v.video_id
  • Buffers: shared hit=2874
4. 0.125 0.125 ↓ 2.2 1,200 1

Seq Scan on video v (cost=0.00..15.40 rows=540 width=4) (actual time=0.008..0.125 rows=1,200 loops=1)

  • Buffers: shared hit=8
5.          

SubPlan (forHashAggregate)

6. 2.400 4.800 ↑ 1.0 1 1,200

Aggregate (cost=8.08..8.09 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=1,200)

  • Buffers: shared hit=2866
7. 1.200 2.400 ↓ 0.0 0 1,200

Bitmap Heap Scan on likes l (cost=4.29..8.08 rows=2 width=4) (actual time=0.002..0.002 rows=0 loops=1,200)

  • Recheck Cond: (video_id = v.video_id)
  • Filter: (user_id <> $1)
  • Heap Blocks: exact=459
  • Buffers: shared hit=2866
8. 1.200 1.200 ↓ 0.0 0 1,200

Bitmap Index Scan on likes_video_id (cost=0.00..4.29 rows=2 width=0) (actual time=0.001..0.001 rows=0 loops=1,200)

  • Index Cond: (video_id = v.video_id)
  • Buffers: shared hit=2407