explain.depesz.com

PostgreSQL's explain analyze made readable

Result: iEm1

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 9,311.405 ↑ 1.0 10 1

Limit (cost=689,360.43..689,360.46 rows=10 width=320) (actual time=9,311.400..9,311.405 rows=10 loops=1)

2. 2.787 9,311.404 ↑ 214.8 10 1

Sort (cost=689,360.43..689,365.80 rows=2,148 width=320) (actual time=9,311.399..9,311.404 rows=10 loops=1)

  • Sort Key: bp1.date_last_comment DESC
  • Sort Method: top-N heapsort Memory: 55kB
3. 74.567 9,308.617 ↓ 2.2 4,748 1

GroupAggregate (cost=689,238.83..689,314.01 rows=2,148 width=320) (actual time=9,227.542..9,308.617 rows=4,748 loops=1)

  • Group Key: bp1.id_post
4. 14.652 9,234.050 ↓ 2.1 8,835 1

Sort (cost=689,238.83..689,249.57 rows=4,296 width=320) (actual time=9,227.510..9,234.050 rows=8,835 loops=1)

  • Sort Key: bp1.id_post
  • Sort Method: quicksort Memory: 10934kB
5. 4.094 9,219.398 ↓ 2.1 8,835 1

Nested Loop Left Join (cost=320.60..688,979.60 rows=4,296 width=320) (actual time=0.626..9,219.398 rows=8,835 loops=1)

6. 46.916 46.916 ↓ 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..46.916 rows=4,748 loops=1)

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

Subquery Scan on j1 (cost=320.17..320.20 rows=2 width=251) (actual time=1.929..1.931 rows=2 loops=4,748)

8. 4.748 9,154.144 ↑ 1.0 2 4,748

Limit (cost=320.17..320.18 rows=2 width=478) (actual time=1.927..1.928 rows=2 loops=4,748)

9. 94.960 9,149.396 ↑ 19.0 2 4,748

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

  • Sort Key: bc1.thread_date DESC
  • Sort Method: top-N heapsort Memory: 25kB
10. 878.380 9,054.436 ↑ 1.1 35 4,748

GroupAggregate (cost=318.84..319.79 rows=38 width=478) (actual time=1.722..1.907 rows=35 loops=4,748)

  • Group Key: bc1.id_comment, bcv1.is_up
11. 213.660 8,176.056 ↓ 1.3 48 4,748

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

  • Sort Key: bc1.id_comment, bcv1.is_up
  • Sort Method: quicksort Memory: 48kB
12. 62.568 7,962.396 ↓ 1.3 48 4,748

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

13. 145.792 1,338.936 ↑ 1.1 35 4,748

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

14. 688.460 688.460 ↑ 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.016..0.145 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. 168.228 6,560.892 ↑ 1.0 1 168,228

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

17. 168.228 6,392.664 ↑ 1.0 1 168,228

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

18. 672.912 6,224.436 ↑ 1.0 1 168,228

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

  • Sort Key: bc2.comment_number DESC
  • Sort Method: quicksort Memory: 25kB
19. 271.827 5,551.524 ↓ 4.0 4 168,228

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

20. 3,028.104 3,028.104 ↓ 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.006..0.018 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. 2,251.593 2,251.593 ↓ 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.003..0.003 rows=0 loops=750,531)

  • Index Cond: ((id_user = 288) AND (bc2.id_comment = id_comment))
Planning time : 5.759 ms
Execution time : 9,312.591 ms