explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bgwT

Settings
# exclusive inclusive rows x rows loops node
1. 0.017 4,202.964 ↑ 1.0 100 1

Limit (cost=702,252.90..702,253.15 rows=100 width=1,011) (actual time=4,202.926..4,202.964 rows=100 loops=1)

2. 617.031 4,202.947 ↑ 9,547.6 100 1

Sort (cost=702,252.90..704,639.81 rows=954,763 width=1,011) (actual time=4,202.924..4,202.947 rows=100 loops=1)

  • Sort Key: herald_activity."timestamp" DESC, herald_activity.id DESC
  • Sort Method: top-N heapsort Memory: 98kB
3. 1,124.279 3,585.916 ↓ 1.0 954,764 1

Hash Left Join (cost=36,602.69..665,762.54 rows=954,763 width=1,011) (actual time=316.623..3,585.916 rows=954,764 loops=1)

  • Hash Cond: (herald_comment.article_id = t9.id)
4. 376.865 2,385.356 ↓ 1.0 954,764 1

Hash Left Join (cost=26,771.46..450,932.32 rows=954,763 width=779) (actual time=239.977..2,385.356 rows=954,764 loops=1)

  • Hash Cond: (herald_activity.article_id = herald_article.id)
5. 258.165 1,916.793 ↓ 1.0 954,764 1

Hash Left Join (cost=16,940.23..298,598.74 rows=954,763 width=547) (actual time=148.201..1,916.793 rows=954,764 loops=1)

  • Hash Cond: (herald_activity.relation_id = herald_relation.id)
6. 433.469 1,561.001 ↓ 1.0 954,764 1

Hash Left Join (cost=5,246.19..199,648.40 rows=954,763 width=321) (actual time=50.509..1,561.001 rows=954,764 loops=1)

  • Hash Cond: (herald_comment.user_id = t8.id)
7. 444.789 1,106.950 ↓ 1.0 954,764 1

Hash Join (cost=2,623.52..126,026.35 rows=954,763 width=218) (actual time=29.789..1,106.950 rows=954,764 loops=1)

  • Hash Cond: (herald_activity.actor_id = herald_user.id)
8. 326.730 632.555 ↓ 1.0 954,764 1

Merge Left Join (cost=0.85..76,173.69 rows=954,763 width=115) (actual time=0.016..632.555 rows=954,764 loops=1)

  • Merge Cond: (herald_activity.comment_id = herald_comment.id)
9. 162.709 162.709 ↓ 1.0 954,764 1

Index Scan using herald_activity_comment_id_c61795af on herald_activity (cost=0.42..35,117.23 rows=954,763 width=64) (actual time=0.006..162.709 rows=954,764 loops=1)

10. 143.116 143.116 ↑ 1.0 807,098 1

Index Scan using herald_comment_pkey on herald_comment (cost=0.42..28,990.79 rows=807,098 width=51) (actual time=0.006..143.116 rows=807,098 loops=1)

11. 18.389 29.606 ↑ 1.0 34,252 1

Hash (cost=1,658.52..1,658.52 rows=34,252 width=103) (actual time=29.606..29.606 rows=34,252 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 2706kB
12. 11.217 11.217 ↑ 1.0 34,252 1

Seq Scan on herald_user (cost=0.00..1,658.52 rows=34,252 width=103) (actual time=0.016..11.217 rows=34,252 loops=1)

13. 13.342 20.582 ↑ 1.0 34,252 1

Hash (cost=1,658.52..1,658.52 rows=34,252 width=103) (actual time=20.582..20.582 rows=34,252 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 2707kB
14. 7.240 7.240 ↑ 1.0 34,252 1

Seq Scan on herald_user t8 (cost=0.00..1,658.52 rows=34,252 width=103) (actual time=0.010..7.240 rows=34,252 loops=1)

15. 21.971 97.627 ↑ 1.0 39,394 1

Hash (cost=9,969.62..9,969.62 rows=39,394 width=226) (actual time=97.627..97.627 rows=39,394 loops=1)

  • Buckets: 16384 Batches: 4 Memory Usage: 2915kB
16. 15.933 75.656 ↑ 1.0 39,394 1

Hash Left Join (cost=5,245.34..9,969.62 rows=39,394 width=226) (actual time=37.513..75.656 rows=39,394 loops=1)

  • Hash Cond: (herald_relation.followed_id = t5.id)
17. 17.557 41.781 ↑ 1.0 39,394 1

Hash Left Join (cost=2,622.67..4,807.28 rows=39,394 width=123) (actual time=19.458..41.781 rows=39,394 loops=1)

  • Hash Cond: (herald_relation.follower_id = t4.id)
18. 4.896 4.896 ↑ 1.0 39,394 1

Seq Scan on herald_relation (cost=0.00..644.94 rows=39,394 width=20) (actual time=0.006..4.896 rows=39,394 loops=1)

19. 12.282 19.328 ↑ 1.0 34,252 1

Hash (cost=1,658.52..1,658.52 rows=34,252 width=103) (actual time=19.328..19.328 rows=34,252 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 2707kB
20. 7.046 7.046 ↑ 1.0 34,252 1

Seq Scan on herald_user t4 (cost=0.00..1,658.52 rows=34,252 width=103) (actual time=0.005..7.046 rows=34,252 loops=1)

21. 11.494 17.942 ↑ 1.0 34,252 1

Hash (cost=1,658.52..1,658.52 rows=34,252 width=103) (actual time=17.942..17.942 rows=34,252 loops=1)

  • Buckets: 32768 Batches: 2 Memory Usage: 2705kB
22. 6.448 6.448 ↑ 1.0 34,252 1

Seq Scan on herald_user t5 (cost=0.00..1,658.52 rows=34,252 width=103) (actual time=0.005..6.448 rows=34,252 loops=1)

23. 55.582 91.698 ↑ 1.0 112,899 1

Hash (cost=4,890.99..4,890.99 rows=112,899 width=232) (actual time=91.698..91.698 rows=112,899 loops=1)

  • Buckets: 16384 Batches: 8 Memory Usage: 3859kB
24. 36.116 36.116 ↑ 1.0 112,899 1

Seq Scan on herald_article (cost=0.00..4,890.99 rows=112,899 width=232) (actual time=0.009..36.116 rows=112,899 loops=1)

25. 53.337 76.281 ↑ 1.0 112,899 1

Hash (cost=4,890.99..4,890.99 rows=112,899 width=232) (actual time=76.281..76.281 rows=112,899 loops=1)

  • Buckets: 16384 Batches: 8 Memory Usage: 3889kB
26. 22.944 22.944 ↑ 1.0 112,899 1

Seq Scan on herald_article t9 (cost=0.00..4,890.99 rows=112,899 width=232) (actual time=0.006..22.944 rows=112,899 loops=1)

Planning time : 9.760 ms
Execution time : 4,204.353 ms