explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9KB

Settings
# exclusive inclusive rows x rows loops node
1. 3.855 390.266 ↑ 1.0 10 1

Limit (cost=33,949.92..33,949.95 rows=10 width=12) (actual time=386.409..390.266 rows=10 loops=1)

  • Buffers: shared hit=290 read=2194, temp read=443 written=445
2. 9.910 386.411 ↑ 10,000.0 10 1

Sort (cost=33,949.92..34,199.92 rows=100,000 width=12) (actual time=386.409..386.411 rows=10 loops=1)

  • Sort Key: (COALESCE(count(likes.video_id), '0'::bigint)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=129 read=1136, temp read=218 written=219
3. 22.285 376.501 ↑ 1.2 86,591 1

Finalize GroupAggregate (cost=17,156.61..31,788.96 rows=100,000 width=12) (actual time=302.710..376.501 rows=86,591 loops=1)

  • Group Key: video.video_id
  • Buffers: shared hit=126 read=1136, temp read=218 written=219
4. 0.000 354.216 ↓ 1.3 126,635 1

Gather Merge (cost=17,156.61..30,288.96 rows=100,000 width=12) (actual time=302.704..354.216 rows=126,635 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
  • Buffers: shared hit=287 read=2194, temp read=443 written=445
5. 40.548 656.606 ↑ 1.6 63,318 2

Partial GroupAggregate (cost=16,156.60..18,038.95 rows=100,000 width=12) (actual time=297.449..328.303 rows=63,318 loops=2)

  • Group Key: video.video_id
  • Buffers: shared hit=287 read=2194, temp read=443 written=445
6. 116.794 616.058 ↑ 1.2 99,999 2

Sort (cost=16,156.60..16,450.72 rows=117,646 width=8) (actual time=297.437..308.029 rows=99,999 loops=2)

  • Sort Key: video.video_id
  • Sort Method: external merge Disk: 1744kB
  • Worker 0: Sort Method: external merge Disk: 1800kB
  • Buffers: shared hit=287 read=2194, temp read=443 written=445
7. 79.062 499.264 ↑ 1.2 99,999 2

Parallel Hash Join (cost=3,194.98..6,248.40 rows=117,646 width=8) (actual time=71.830..249.632 rows=99,999 loops=2)

  • Hash Cond: (likes.video_id = video.video_id)
  • Buffers: shared hit=260 read=2194
8. 277.812 277.812 ↑ 1.2 99,999 2

Parallel Seq Scan on likes (cost=0.00..2,744.59 rows=117,646 width=4) (actual time=0.300..138.906 rows=99,999 loops=2)

  • Filter: (user_id <> 10)
  • Rows Removed by Filter: 1
  • Buffers: shared read=1274
9. 25.194 142.390 ↓ 1.2 50,000 2

Parallel Hash (cost=2,674.14..2,674.14 rows=41,667 width=4) (actual time=71.194..71.195 rows=50,000 loops=2)

  • Buckets: 131072 Batches: 1 Memory Usage: 4992kB
  • Buffers: shared hit=249 read=920
10. 117.196 117.196 ↓ 1.2 50,000 2

Parallel Index Only Scan using video_pkey on video (cost=0.29..2,674.14 rows=41,667 width=4) (actual time=0.042..58.598 rows=50,000 loops=2)

  • Heap Fetches: 100000
  • Buffers: shared hit=249 read=920