explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1y5i

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 6,395.256 ↑ 1.0 10 1

Limit (cost=274,441.16..274,441.19 rows=10 width=318) (actual time=6,395.251..6,395.256 rows=10 loops=1)

2. 2.589 6,395.255 ↑ 205.0 10 1

Sort (cost=274,441.16..274,446.29 rows=2,050 width=318) (actual time=6,395.251..6,395.255 rows=10 loops=1)

  • Sort Key: bp1.date_last_comment DESC
  • Sort Method: top-N heapsort Memory: 61kB
3. 63.209 6,392.666 ↓ 1.9 3,878 1

GroupAggregate (cost=274,325.11..274,396.86 rows=2,050 width=318) (actual time=6,325.139..6,392.666 rows=3,878 loops=1)

  • Group Key: bp1.id_post
4. 11.459 6,329.457 ↓ 1.8 7,268 1

Sort (cost=274,325.11..274,335.36 rows=4,100 width=318) (actual time=6,325.104..6,329.457 rows=7,268 loops=1)

  • Sort Key: bp1.id_post
  • Sort Method: quicksort Memory: 8853kB
5. 4.563 6,317.998 ↓ 1.8 7,268 1

Nested Loop Left Join (cost=133.55..274,079.09 rows=4,100 width=318) (actual time=0.138..6,317.998 rows=7,268 loops=1)

6. 38.831 38.831 ↓ 1.9 3,878 1

Index Scan using fki_blog_posts_blogs on posts bp1 (cost=0.43..1,099.36 rows=2,050 width=68) (actual time=0.018..38.831 rows=3,878 loops=1)

  • Index Cond: (id_blog = ANY ('{1,22,6}'::integer[]))
  • Filter: (NOT is_deleted)
  • Rows Removed by Filter: 1750
7. 11.634 6,274.604 ↑ 1.0 2 3,878

Subquery Scan on j1 (cost=133.12..133.14 rows=2 width=250) (actual time=1.616..1.618 rows=2 loops=3,878)

8. 3.878 6,262.970 ↑ 1.0 2 3,878

Limit (cost=133.12..133.12 rows=2 width=476) (actual time=1.614..1.615 rows=2 loops=3,878)

9. 93.072 6,259.092 ↑ 19.0 2 3,878

Sort (cost=133.12..133.21 rows=38 width=476) (actual time=1.613..1.614 rows=2 loops=3,878)

  • Sort Key: bc1.thread_date DESC
  • Sort Method: top-N heapsort Memory: 25kB
10. 938.476 6,166.020 ↓ 1.1 42 3,878

GroupAggregate (cost=131.88..132.74 rows=38 width=476) (actual time=1.342..1.590 rows=42 loops=3,878)

  • Group Key: bc1.id_comment
11. 205.534 5,227.544 ↓ 1.5 56 3,878

Sort (cost=131.88..131.98 rows=38 width=476) (actual time=1.332..1.348 rows=56 loops=3,878)

  • Sort Key: bc1.id_comment
  • Sort Method: quicksort Memory: 48kB
12. 164.652 5,022.010 ↓ 1.5 56 3,878

Nested Loop Left Join (cost=3.16..130.88 rows=38 width=476) (actual time=0.056..1.295 rows=56 loops=3,878)

13. 667.016 667.016 ↓ 1.1 42 3,878

Index Scan using idx_comments_posts_parents on comments bc1 (cost=0.56..31.32 rows=38 width=234) (actual time=0.020..0.172 rows=42 loops=3,878)

  • Index Cond: ((id_post = bp1.id_post) AND (id_parent = 0))
14. 161.167 4,190.342 ↑ 1.0 1 161,167

Subquery Scan on j2 (cost=2.59..2.61 rows=1 width=250) (actual time=0.025..0.026 rows=1 loops=161,167)

15. 161.167 4,029.175 ↑ 1.0 1 161,167

Limit (cost=2.59..2.60 rows=1 width=226) (actual time=0.025..0.025 rows=1 loops=161,167)

16. 644.668 3,868.008 ↑ 1.0 1 161,167

Sort (cost=2.59..2.60 rows=1 width=226) (actual time=0.024..0.024 rows=1 loops=161,167)

  • Sort Key: bc2.comment_number DESC
  • Sort Method: quicksort Memory: 25kB
17. 3,223.340 3,223.340 ↓ 4.0 4 161,167

Index Scan using idx_comments_posts_roots on comments bc2 (cost=0.56..2.58 rows=1 width=226) (actual time=0.006..0.020 rows=4 loops=161,167)

  • Index Cond: ((id_post = bc1.id_post) AND (id_root = bc1.id_comment))
  • Filter: (id_parent <> 0)
  • Rows Removed by Filter: 1
Planning time : 0.801 ms
Execution time : 6,395.419 ms