explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5Ay6 : Optimization for: plan #laPv

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 127.049 10,372.128 ↓ 22.0 22 1

Limit (cost=352,152.49..352,152.61 rows=1 width=674) (actual time=10,372.079..10,372.128 rows=22 loops=1)

2. 272.710 10,245.079 ↓ 1.0 307,172 1

Gather Merge (cost=316,403.07..352,152.49 rows=298,572 width=674) (actual time=5,191.391..10,245.079 rows=307,172 loops=1)

  • Workers Planned: 4
  • Workers Launched: 0
3. 6,086.653 9,972.369 ↓ 4.1 307,172 1

Sort (cost=315,403.02..315,589.62 rows=74,643 width=674) (actual time=5,190.406..9,972.369 rows=307,172 loops=1)

  • Sort Key: comments."timestamp
  • Sort Method: external merge Disk: 223400kB
4. 396.118 3,885.716 ↓ 4.1 307,172 1

Parallel Hash Left Join (cost=12,978.95..296,210.77 rows=74,643 width=674) (actual time=304.617..3,885.716 rows=307,172 loops=1)

  • Hash Cond: (comments_parent.user_id = parent_users.id)
5. 604.187 3,400.053 ↓ 4.1 307,172 1

Nested Loop Left Join (cost=8,845.00..291,880.87 rows=74,643 width=673) (actual time=214.512..3,400.053 rows=307,172 loops=1)

6. 353.195 1,874.350 ↓ 4.1 307,172 1

Hash Left Join (cost=8,844.57..201,917.78 rows=74,643 width=649) (actual time=214.448..1,874.350 rows=307,172 loops=1)

  • Hash Cond: (comments.id = votes.comments_talks_id)
7. 373.655 1,521.144 ↓ 4.1 307,172 1

Hash Left Join (cost=8,796.32..201,673.59 rows=74,643 width=637) (actual time=214.415..1,521.144 rows=307,172 loops=1)

  • Hash Cond: (users.id = rating.user_id)
8. 446.310 1,118.156 ↓ 4.1 307,172 1

Parallel Hash Left Join (cost=8,091.71..200,773.03 rows=74,643 width=637) (actual time=184.916..1,118.156 rows=307,172 loops=1)

  • Hash Cond: (comments.user_id = users.id)
9. 516.770 553.703 ↓ 4.1 307,172 1

Parallel Bitmap Heap Scan on comments_talks comments (cost=3,957.76..196,443.13 rows=74,643 width=610) (actual time=66.251..553.703 rows=307,172 loops=1)

  • Recheck Cond: (talk_id = 7606)
  • Heap Blocks: exact=97940
10. 36.933 36.933 ↓ 1.0 307,172 1

Bitmap Index Scan on comments_talks_k_talk (cost=0.00..3,883.12 rows=298,572 width=0) (actual time=36.932..36.933 rows=307,172 loops=1)

  • Index Cond: (talk_id = 7606)
11. 58.675 118.143 ↓ 2.4 68,300 1

Parallel Hash (cost=3,778.97..3,778.97 rows=28,398 width=27) (actual time=118.142..118.143 rows=68,300 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 5248kB
12. 59.468 59.468 ↓ 2.4 68,300 1

Parallel Seq Scan on users (cost=0.00..3,778.97 rows=28,398 width=27) (actual time=0.011..59.468 rows=68,300 loops=1)

13. 15.156 29.333 ↑ 1.0 25,090 1

Hash (cost=389.27..389.27 rows=25,227 width=16) (actual time=29.332..29.333 rows=25,090 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1433kB
14. 14.177 14.177 ↑ 1.0 25,090 1

Seq Scan on users_rating_view rating (cost=0.00..389.27 rows=25,227 width=16) (actual time=0.019..14.177 rows=25,090 loops=1)

15. 0.001 0.011 ↓ 0.0 0 1

Hash (cost=27.00..27.00 rows=1,700 width=20) (actual time=0.011..0.011 rows=0 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 16kB
16. 0.010 0.010 ↓ 0.0 0 1

Seq Scan on comments_talks_votes_count votes (cost=0.00..27.00 rows=1,700 width=20) (actual time=0.009..0.010 rows=0 loops=1)

17. 921.516 921.516 ↑ 1.0 1 307,172

Index Scan using comments_talks_pk on comments_talks comments_parent (cost=0.43..1.21 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=307,172)

  • Index Cond: (id = comments.parent)
18. 46.031 89.545 ↓ 2.4 68,300 1

Parallel Hash (cost=3,778.97..3,778.97 rows=28,398 width=17) (actual time=89.544..89.545 rows=68,300 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 4640kB
19. 43.514 43.514 ↓ 2.4 68,300 1

Parallel Seq Scan on users parent_users (cost=0.00..3,778.97 rows=28,398 width=17) (actual time=0.013..43.514 rows=68,300 loops=1)