explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Rwn

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 43.756 ↑ 1.0 10 1

Limit (cost=19,271.59..19,271.62 rows=10 width=12) (actual time=43.752..43.756 rows=10 loops=1)

  • Buffers: shared hit=4813
2. 0.226 43.753 ↑ 54.0 10 1

Sort (cost=19,271.59..19,272.94 rows=540 width=12) (actual time=43.752..43.753 rows=10 loops=1)

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

Group (cost=0.28..19,259.92 rows=540 width=12) (actual time=0.051..43.527 rows=1,200 loops=1)

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

Index Only Scan using video_pkey on video v (cost=0.28..72.38 rows=540 width=4) (actual time=0.009..0.371 rows=1,200 loops=1)

  • Heap Fetches: 1200
  • Buffers: shared hit=13
5.          

SubPlan (forGroup)

6. 2.400 42.000 ↑ 1.0 1 1,200

Aggregate (cost=35.52..35.53 rows=1 width=8) (actual time=0.035..0.035 rows=1 loops=1,200)

  • Buffers: shared hit=4800
7. 39.600 39.600 ↓ 0.0 0 1,200

Seq Scan on likes l (cost=0.00..35.50 rows=8 width=4) (actual time=0.028..0.033 rows=0 loops=1,200)

  • Filter: ((user_id <> $1) AND (video_id = v.video_id))
  • Rows Removed by Filter: 480
  • Buffers: shared hit=4800