explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JYJb

Settings
# exclusive inclusive rows x rows loops node
1. 0.516 212.051 ↑ 128.2 13 1

Subquery Scan on t (cost=14,257.53..14,407.53 rows=1,667 width=12) (actual time=205.578..212.051 rows=13 loops=1)

  • Filter: (t.rk <= 10)
  • Rows Removed by Filter: 4987
2. 5.279 211.535 ↑ 1.0 5,000 1

WindowAgg (cost=14,257.53..14,345.03 rows=5,000 width=20) (actual time=205.578..211.535 rows=5,000 loops=1)

3. 1.792 206.256 ↑ 1.0 5,000 1

Sort (cost=14,257.53..14,270.03 rows=5,000 width=12) (actual time=205.557..206.256 rows=5,000 loops=1)

  • Sort Key: (COALESCE(r1.rank, '0'::bigint)) DESC
  • Sort Method: quicksort Memory: 427kB
4. 1.617 204.464 ↑ 1.0 5,000 1

Hash Left Join (cost=13,854.20..13,950.33 rows=5,000 width=12) (actual time=202.290..204.464 rows=5,000 loops=1)

  • Hash Cond: (v.video_id = r1.vid)
5. 0.611 0.611 ↑ 1.0 5,000 1

Seq Scan on video v (cost=0.00..83.00 rows=5,000 width=4) (actual time=0.016..0.611 rows=5,000 loops=1)

6. 0.781 202.236 ↑ 1.0 4,993 1

Hash (cost=13,791.72..13,791.72 rows=4,998 width=12) (actual time=202.236..202.236 rows=4,993 loops=1)

  • Buckets: 8192 Batches: 1 Memory Usage: 279kB
7. 0.395 201.455 ↑ 1.0 4,993 1

Subquery Scan on r1 (cost=13,691.76..13,791.72 rows=4,998 width=12) (actual time=200.328..201.455 rows=4,993 loops=1)

8. 3.102 201.060 ↑ 1.0 4,993 1

Finalize HashAggregate (cost=13,691.76..13,741.74 rows=4,998 width=12) (actual time=200.326..201.060 rows=4,993 loops=1)

  • Group Key: l.video_id
9. 60.972 197.958 ↓ 1.5 14,979 1

Gather (cost=12,592.20..13,641.78 rows=9,996 width=12) (actual time=192.334..197.958 rows=14,979 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
10. 57.062 136.986 ↑ 1.0 4,993 3

Partial HashAggregate (cost=11,592.20..11,642.18 rows=4,998 width=12) (actual time=136.121..136.986 rows=4,993 loops=3)

  • Group Key: l.video_id
11. 26.608 79.924 ↑ 1.2 166,427 3

Hash Anti Join (cost=36.15..10,554.15 rows=207,611 width=4) (actual time=0.582..79.924 rows=166,427 loops=3)

  • Hash Cond: (l.video_id = w.video_id)
12. 32.303 52.928 ↑ 1.2 166,464 3

Hash Anti Join (cost=27.84..7,924.59 rows=207,653 width=4) (actual time=0.180..52.928 rows=166,464 loops=3)

  • Hash Cond: (l.video_id = l_user.video_id)
13. 20.489 20.489 ↑ 1.2 166,667 3

Parallel Seq Scan on likes l (cost=0.00..5,268.33 rows=208,333 width=4) (actual time=0.016..20.489 rows=166,667 loops=3)

14. 0.019 0.136 ↑ 1.0 6 3

Hash (cost=27.76..27.76 rows=6 width=4) (actual time=0.136..0.136 rows=6 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
15. 0.045 0.117 ↑ 1.0 6 3

Bitmap Heap Scan on likes l_user (cost=4.47..27.76 rows=6 width=4) (actual time=0.083..0.117 rows=6 loops=3)

  • Recheck Cond: (user_id = 10)
  • Heap Blocks: exact=6
16. 0.072 0.072 ↑ 1.0 6 3

Bitmap Index Scan on likes_index (cost=0.00..4.47 rows=6 width=0) (actual time=0.072..0.072 rows=6 loops=3)

  • Index Cond: (user_id = 10)
17. 0.013 0.388 ↑ 1.0 1 3

Hash (cost=8.30..8.30 rows=1 width=4) (actual time=0.388..0.388 rows=1 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
18. 0.375 0.375 ↑ 1.0 1 3

Index Only Scan using watch_index on watch w (cost=0.28..8.30 rows=1 width=4) (actual time=0.373..0.375 rows=1 loops=3)

  • Index Cond: (user_id = 10)
  • Heap Fetches: 3