explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Y6hd

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 1,663.534 ↑ 1.0 2 1

Limit (cost=271,716.81..271,716.81 rows=2 width=320) (actual time=1,663.534..1,663.534 rows=2 loops=1)

2. 2.674 1,663.533 ↑ 1,074.0 2 1

Sort (cost=271,716.81..271,722.18 rows=2,148 width=320) (actual time=1,663.533..1,663.533 rows=2 loops=1)

  • Sort Key: bp1.date_last_comment DESC
  • Sort Method: top-N heapsort Memory: 26kB
3. 41.276 1,660.859 ↓ 2.2 4,748 1

GroupAggregate (cost=271,630.89..271,695.33 rows=2,148 width=320) (actual time=1,616.705..1,660.859 rows=4,748 loops=1)

  • Group Key: bp1.id_post
4. 8.698 1,619.583 ↓ 2.1 8,835 1

Sort (cost=271,630.89..271,641.63 rows=4,296 width=320) (actual time=1,616.640..1,619.583 rows=8,835 loops=1)

  • Sort Key: bp1.id_post
  • Sort Method: quicksort Memory: 6918kB
5. 5.323 1,610.885 ↓ 2.1 8,835 1

Nested Loop Left Join (cost=126.19..271,371.65 rows=4,296 width=320) (actual time=0.368..1,610.885 rows=8,835 loops=1)

6. 38.722 38.722 ↓ 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.018..38.722 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 1,566.840 ↑ 1.0 2 4,748

Subquery Scan on c1 (cost=125.75..125.78 rows=2 width=251) (actual time=0.329..0.330 rows=2 loops=4,748)

8. 4.748 1,557.344 ↑ 1.0 2 4,748

Limit (cost=125.75..125.76 rows=2 width=227) (actual time=0.327..0.328 rows=2 loops=4,748)

9. 71.220 1,552.596 ↑ 19.0 2 4,748

Sort (cost=125.75..125.85 rows=38 width=227) (actual time=0.326..0.327 rows=2 loops=4,748)

  • Sort Key: bc1.thread_date DESC
  • Sort Method: top-N heapsort Memory: 25kB
10. 156.684 1,481.376 ↑ 1.1 35 4,748

HashAggregate (cost=124.99..125.37 rows=38 width=227) (actual time=0.304..0.312 rows=35 loops=4,748)

  • Group Key: bc1.id_comment, bcv1.is_up
11. 98.312 1,324.692 ↑ 1.1 35 4,748

Nested Loop Left Join (cost=0.99..124.80 rows=38 width=227) (actual time=0.020..0.279 rows=35 loops=4,748)

12. 721.696 721.696 ↑ 1.1 35 4,748

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

  • Index Cond: ((id_post = bp1.id_post) AND (id_parent = 0))
13. 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))
Planning time : 2.445 ms
Execution time : 1,663.679 ms