explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DtdH

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 11,583.261 ↑ 1.0 10 1

Limit (cost=657,903.91..657,903.94 rows=10 width=319) (actual time=11,583.256..11,583.261 rows=10 loops=1)

2. 2.482 11,583.258 ↑ 205.0 10 1

Sort (cost=657,903.91..657,909.04 rows=2,050 width=319) (actual time=11,583.255..11,583.258 rows=10 loops=1)

  • Sort Key: bp1.date_last_comment DESC
  • Sort Method: top-N heapsort Memory: 61kB
3. 64.906 11,580.776 ↓ 1.9 3,878 1

GroupAggregate (cost=657,787.86..657,859.61 rows=2,050 width=319) (actual time=11,512.240..11,580.776 rows=3,878 loops=1)

  • Group Key: bp1.id_post
4. 9.956 11,515.870 ↓ 1.8 7,268 1

Sort (cost=657,787.86..657,798.11 rows=4,100 width=319) (actual time=11,512.205..11,515.870 rows=7,268 loops=1)

  • Sort Key: bp1.id_post
  • Sort Method: quicksort Memory: 8991kB
5. 6.071 11,505.914 ↓ 1.8 7,268 1

Nested Loop Left Join (cost=320.60..657,541.84 rows=4,100 width=319) (actual time=4.877..11,505.914 rows=7,268 loops=1)

6. 40.353 40.353 ↓ 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.017..40.353 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 11,459.490 ↑ 1.0 2 3,878

Subquery Scan on j1 (cost=320.17..320.20 rows=2 width=251) (actual time=2.953..2.955 rows=2 loops=3,878)

8. 3.878 11,447.856 ↑ 1.0 2 3,878

Limit (cost=320.17..320.18 rows=2 width=478) (actual time=2.951..2.952 rows=2 loops=3,878)

9. 96.950 11,443.978 ↑ 19.0 2 3,878

Sort (cost=320.17..320.27 rows=38 width=478) (actual time=2.951..2.951 rows=2 loops=3,878)

  • Sort Key: bc1.thread_date DESC
  • Sort Method: top-N heapsort Memory: 25kB
10. 915.208 11,347.028 ↓ 1.1 42 3,878

GroupAggregate (cost=318.84..319.79 rows=38 width=478) (actual time=2.687..2.926 rows=42 loops=3,878)

  • Group Key: bc1.id_comment, bcv1.is_up
11. 224.924 10,431.820 ↓ 1.5 56 3,878

Sort (cost=318.84..318.94 rows=38 width=478) (actual time=2.676..2.690 rows=56 loops=3,878)

  • Sort Key: bc1.id_comment, bcv1.is_up
  • Sort Method: quicksort Memory: 48kB
12. 172.935 10,206.896 ↓ 1.5 56 3,878

Nested Loop Left Join (cost=6.05..317.84 rows=38 width=478) (actual time=0.081..2.632 rows=56 loops=3,878)

13. 112.331 2,136.778 ↓ 1.1 42 3,878

Nested Loop Left Join (cost=0.99..124.80 rows=38 width=235) (actual time=0.036..0.551 rows=42 loops=3,878)

14. 573.944 573.944 ↓ 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.016..0.148 rows=42 loops=3,878)

  • Index Cond: ((id_post = bp1.id_post) AND (id_parent = 0))
15. 1,450.503 1,450.503 ↓ 0.0 0 161,167

Index Scan using pk_blog_comment_votes on comment_votes bcv1 (cost=0.43..2.45 rows=1 width=9) (actual time=0.009..0.009 rows=0 loops=161,167)

  • Index Cond: ((id_user = 288) AND (bc1.id_comment = id_comment))
16. 161.167 7,897.183 ↑ 1.0 1 161,167

Subquery Scan on j2 (cost=5.05..5.07 rows=1 width=251) (actual time=0.049..0.049 rows=1 loops=161,167)

17. 0.000 7,736.016 ↑ 1.0 1 161,167

Limit (cost=5.05..5.06 rows=1 width=227) (actual time=0.048..0.048 rows=1 loops=161,167)

18. 805.835 7,736.016 ↑ 1.0 1 161,167

Sort (cost=5.05..5.06 rows=1 width=227) (actual time=0.048..0.048 rows=1 loops=161,167)

  • Sort Key: bc2.comment_number DESC
  • Sort Method: quicksort Memory: 25kB
19. 973.628 6,930.181 ↓ 4.0 4 161,167

Nested Loop Left Join (cost=0.99..5.04 rows=1 width=227) (actual time=0.009..0.043 rows=4 loops=161,167)

20. 3,062.173 3,062.173 ↓ 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.019 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
21. 2,894.380 2,894.380 ↓ 0.0 0 723,595

Index Scan using pk_blog_comment_votes on comment_votes bcv2 (cost=0.43..2.45 rows=1 width=9) (actual time=0.004..0.004 rows=0 loops=723,595)

  • Index Cond: ((id_user = 288) AND (bc2.id_comment = id_comment))
Planning time : 3.767 ms
Execution time : 11,583.460 ms