explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 0NPj

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

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

  • Buffers: shared hit=8 read=2573, temp read=1325 written=1328
2. 12.808 344.660 ↑ 19,999.8 10 1

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

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

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

  • Group Key: video.video_id
  • Buffers: shared hit=5 read=2573, temp read=1325 written=1328
4. 87.409 297.020 ↑ 1.0 199,998 1

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

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

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

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

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

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

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

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

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

  • Buffers: shared hit=2 read=1299