explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8BWu

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

Limit (cost=19,263.59..19,263.62 rows=10 width=12) (actual time=12.863..12.865 rows=10 loops=1)

  • Buffers: shared hit=1210
2. 0.163 12.863 ↑ 54.0 10 1

Sort (cost=19,263.59..19,264.94 rows=540 width=12) (actual time=12.863..12.863 rows=10 loops=1)

  • Sort Key: ((SubPlan 1)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=1210
3. 0.310 12.700 ↓ 1.1 600 1

Group (cost=0.28..19,251.92 rows=540 width=12) (actual time=0.188..12.700 rows=600 loops=1)

  • Group Key: v.video_id
  • Buffers: shared hit=1207
4. 0.390 0.390 ↓ 1.1 600 1

Index Only Scan using video_pkey on video v (cost=0.28..64.38 rows=540 width=4) (actual time=0.106..0.390 rows=600 loops=1)

  • Heap Fetches: 600
  • Buffers: shared hit=7
5.          

SubPlan (forGroup)

6. 1.200 12.000 ↑ 1.0 1 600

Aggregate (cost=35.52..35.53 rows=1 width=8) (actual time=0.020..0.020 rows=1 loops=600)

  • Buffers: shared hit=1200
7. 10.800 10.800 ↓ 0.0 0 600

Seq Scan on likes l (cost=0.00..35.50 rows=8 width=4) (actual time=0.015..0.018 rows=0 loops=600)

  • Filter: ((user_id <> 10) AND (video_id = v.video_id))
  • Rows Removed by Filter: 240
  • Buffers: shared hit=1200