explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cZFS

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 6,593.462 ↑ 1.0 2 1

Limit (cost=689,120.69..689,120.70 rows=2 width=320) (actual time=6,593.461..6,593.462 rows=2 loops=1)

2. 3.086 6,593.459 ↑ 1,074.0 2 1

Sort (cost=689,120.69..689,126.06 rows=2,148 width=320) (actual time=6,593.459..6,593.459 rows=2 loops=1)

  • Sort Key: bp1.date_last_comment DESC
  • Sort Method: top-N heapsort Memory: 28kB
3. 66.801 6,590.373 ↓ 2.2 4,748 1

GroupAggregate (cost=689,034.77..689,099.21 rows=2,148 width=320) (actual time=6,519.525..6,590.373 rows=4,748 loops=1)

  • Group Key: bp1.id_post
4. 10.824 6,523.572 ↓ 2.1 8,835 1

Sort (cost=689,034.77..689,045.51 rows=4,296 width=320) (actual time=6,519.378..6,523.572 rows=8,835 loops=1)

  • Sort Key: bp1.id_post
  • Sort Method: quicksort Memory: 10421kB
5. 6.464 6,512.748 ↓ 2.1 8,835 1

Nested Loop Left Join (cost=320.51..688,775.54 rows=4,296 width=320) (actual time=5.419..6,512.748 rows=8,835 loops=1)

6. 15.768 15.768 ↓ 2.2 4,748 1

Index Scan using fki_blog_posts_blogs on posts bp1 (cost=0.43..1,155.97 rows=2,148 width=69) (actual time=0.029..15.768 rows=4,748 loops=1)

  • Index Cond: (id_blog = ANY ('{1,22,16}'::integer[]))
  • Filter: (NOT is_deleted)
  • Rows Removed by Filter: 1914
7. 9.496 6,490.516 ↑ 1.0 2 4,748

Subquery Scan on c1 (cost=320.08..320.10 rows=2 width=251) (actual time=1.366..1.367 rows=2 loops=4,748)

8. 4.748 6,481.020 ↑ 1.0 2 4,748

Limit (cost=320.08..320.08 rows=2 width=478) (actual time=1.364..1.365 rows=2 loops=4,748)

9. 85.464 6,476.272 ↑ 19.0 2 4,748

Sort (cost=320.08..320.17 rows=38 width=478) (actual time=1.364..1.364 rows=2 loops=4,748)

  • Sort Key: bc1.thread_date DESC
  • Sort Method: top-N heapsort Memory: 25kB
10. 460.556 6,390.808 ↑ 1.1 35 4,748

GroupAggregate (cost=318.84..319.70 rows=38 width=478) (actual time=1.246..1.346 rows=35 loops=4,748)

  • Group Key: bc1.id_comment, bcv1.is_up
11. 199.416 5,930.252 ↓ 1.3 48 4,748

Sort (cost=318.84..318.94 rows=38 width=478) (actual time=1.240..1.249 rows=48 loops=4,748)

  • Sort Key: bc1.id_comment, bcv1.is_up
  • Sort Method: quicksort Memory: 48kB
12. 199.048 5,730.836 ↓ 1.3 48 4,748

Nested Loop Left Join (cost=6.05..317.84 rows=38 width=478) (actual time=0.041..1.207 rows=48 loops=4,748)

13. 84.068 821.404 ↑ 1.1 35 4,748

Nested Loop Left Join (cost=0.99..124.80 rows=38 width=235) (actual time=0.013..0.173 rows=35 loops=4,748)

14. 232.652 232.652 ↑ 1.1 35 4,748

Index Scan using idx_comments_posts_parents on comments bc1 (cost=0.56..31.32 rows=38 width=234) (actual time=0.009..0.049 rows=35 loops=4,748)

  • Index Cond: ((id_post = bp1.id_post) AND (id_parent = 0))
15. 504.684 504.684 ↓ 0.0 0 168,228

Index Scan using pk_blog_comment_votes on comment_votes bcv1 (cost=0.43..2.45 rows=1 width=9) (actual time=0.003..0.003 rows=0 loops=168,228)

  • Index Cond: ((id_user = 288) AND (bc1.id_comment = id_comment))
16. 0.000 4,710.384 ↑ 1.0 1 168,228

Subquery Scan on c2 (cost=5.05..5.07 rows=1 width=251) (actual time=0.028..0.028 rows=1 loops=168,228)

17. 168.228 4,710.384 ↑ 1.0 1 168,228

Limit (cost=5.05..5.06 rows=1 width=227) (actual time=0.028..0.028 rows=1 loops=168,228)

18. 672.912 4,542.156 ↑ 1.0 1 168,228

Sort (cost=5.05..5.06 rows=1 width=227) (actual time=0.027..0.027 rows=1 loops=168,228)

  • Sort Key: bc2.comment_number DESC
  • Sort Method: quicksort Memory: 25kB
19. 854.130 3,869.244 ↓ 4.0 4 168,228

Nested Loop Left Join (cost=0.99..5.04 rows=1 width=227) (actual time=0.006..0.023 rows=4 loops=168,228)

20. 1,514.052 1,514.052 ↓ 4.0 4 168,228

Index Scan using idx_comments_posts_roots on comments bc2 (cost=0.56..2.58 rows=1 width=226) (actual time=0.004..0.009 rows=4 loops=168,228)

  • Index Cond: ((id_post = bc1.id_post) AND (id_root = bc1.id_comment))
  • Filter: (id_parent <> 0)
  • Rows Removed by Filter: 1
21. 1,501.062 1,501.062 ↓ 0.0 0 750,531

Index Scan using pk_blog_comment_votes on comment_votes bcv2 (cost=0.43..2.45 rows=1 width=9) (actual time=0.002..0.002 rows=0 loops=750,531)

  • Index Cond: ((id_user = 288) AND (bc2.id_comment = id_comment))
Planning time : 2.813 ms
Execution time : 6,593.702 ms