explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BxBR

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

Limit (cost=41,396.31..41,396.33 rows=10 width=12) (actual time=340.967..340.970 rows=10 loops=1)

  • Buffers: shared hit=2581, temp read=1325 written=1328
2. 12.415 340.967 ↑ 19,999.8 10 1

Sort (cost=41,396.31..41,896.30 rows=199,998 width=12) (actual time=340.967..340.967 rows=10 loops=1)

  • Sort Key: (COALESCE(count(likes.video_id), '0'::bigint)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=2581, temp read=1325 written=1328
3. 34.793 328.552 ↑ 1.6 126,373 1

GroupAggregate (cost=33,574.46..37,074.42 rows=199,998 width=12) (actual time=272.976..328.552 rows=126,373 loops=1)

  • Group Key: video.video_id
  • Buffers: shared hit=2578, temp read=1325 written=1328
4. 87.921 293.759 ↑ 1.0 199,998 1

Sort (cost=33,574.46..34,074.45 rows=199,998 width=8) (actual time=272.962..293.759 rows=199,998 loops=1)

  • Sort Key: video.video_id
  • Sort Method: external merge Disk: 3544kB
  • Buffers: shared hit=2578, temp read=1325 written=1328
5. 103.324 205.838 ↑ 1.0 199,998 1

Hash Join (cost=6,583.00..13,228.01 rows=199,998 width=8) (actual time=65.452..205.838 rows=199,998 loops=1)

  • Hash Cond: (likes.video_id = video.video_id)
  • Buffers: shared hit=2575, temp read=882 written=882
6. 37.699 37.699 ↑ 1.0 199,998 1

Seq Scan on likes (cost=0.00..3,774.00 rows=199,998 width=4) (actual time=0.017..37.699 rows=199,998 loops=1)

  • Filter: (user_id <> 10)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1274
7. 35.606 64.815 ↑ 1.0 200,000 1

Hash (cost=3,301.00..3,301.00 rows=200,000 width=4) (actual time=64.814..64.815 rows=200,000 loops=1)

  • Buckets: 131072 Batches: 4 Memory Usage: 2786kB
  • Buffers: shared hit=1301, temp written=438
8. 29.209 29.209 ↑ 1.0 200,000 1

Seq Scan on video (cost=0.00..3,301.00 rows=200,000 width=4) (actual time=0.009..29.209 rows=200,000 loops=1)

  • Buffers: shared hit=1301