explain.depesz.com

PostgreSQL's explain analyze made readable

Result: S15e

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

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

  • Buffers: shared hit=1207
2. 0.109 12.098 ↑ 54.0 10 1

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

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

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

  • Group Key: v.video_id
  • Buffers: shared hit=1207
4. 0.162 0.162 ↓ 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.011..0.162 rows=600 loops=1)

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

SubPlan (forGroup)

6. 1.200 11.400 ↑ 1.0 1 600

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

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

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

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