explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YPct

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 18,190.794 ↑ 1.0 10 1

Limit (cost=519,923.45..519,923.47 rows=10 width=319) (actual time=18,190.789..18,190.794 rows=10 loops=1)

2. 3.305 18,190.791 ↑ 214.8 10 1

Sort (cost=519,923.45..519,928.82 rows=2,148 width=319) (actual time=18,190.786..18,190.791 rows=10 loops=1)

  • Sort Key: bp1.date_last_comment DESC
  • Sort Method: top-N heapsort Memory: 64kB
3. 82.712 18,187.486 ↓ 2.2 4,748 1

GroupAggregate (cost=519,801.85..519,877.03 rows=2,148 width=319) (actual time=18,100.741..18,187.486 rows=4,748 loops=1)

  • Group Key: bp1.id_post
4. 15.210 18,104.774 ↓ 2.1 8,835 1

Sort (cost=519,801.85..519,812.59 rows=4,296 width=319) (actual time=18,100.609..18,104.774 rows=8,835 loops=1)

  • Sort Key: bp1.id_post
  • Sort Method: quicksort Memory: 13149kB
5. 10.328 18,089.564 ↓ 2.1 8,835 1

Nested Loop Left Join (cost=241.72..519,542.61 rows=4,296 width=319) (actual time=1.479..18,089.564 rows=8,835 loops=1)

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

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

Subquery Scan on j1 (cost=241.29..241.31 rows=2 width=250) (actual time=3.795..3.796 rows=2 loops=4,748)

8. 4.748 18,004.416 ↑ 1.0 2 4,748

Limit (cost=241.29..241.29 rows=2 width=476) (actual time=3.792..3.792 rows=2 loops=4,748)

9. 123.448 17,999.668 ↑ 19.0 2 4,748

Sort (cost=241.29..241.38 rows=38 width=476) (actual time=3.791..3.791 rows=2 loops=4,748)

  • Sort Key: bc1.thread_date DESC
  • Sort Method: top-N heapsort Memory: 26kB
10. 1,761.508 17,876.220 ↑ 1.1 35 4,748

GroupAggregate (cost=239.67..240.91 rows=38 width=476) (actual time=3.397..3.765 rows=35 loops=4,748)

  • Group Key: bc1.id_comment
11. 346.604 16,114.712 ↑ 1.1 70 4,748

Sort (cost=239.67..239.86 rows=76 width=476) (actual time=3.374..3.394 rows=70 loops=4,748)

  • Sort Key: bc1.id_comment
  • Sort Method: quicksort Memory: 96kB
12. 296.624 15,768.108 ↑ 1.1 70 4,748

Nested Loop Left Join (cost=1.12..237.30 rows=76 width=476) (actual time=2.422..3.321 rows=70 loops=4,748)

13. 835.648 835.648 ↑ 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.020..0.176 rows=35 loops=4,748)

  • Index Cond: ((id_post = bp1.id_post) AND (id_parent = 0))
14. 168.228 14,635.836 ↑ 1.0 2 168,228

Subquery Scan on j2 (cost=0.56..5.40 rows=2 width=250) (actual time=0.082..0.087 rows=2 loops=168,228)

15. 168.228 14,467.608 ↑ 1.0 2 168,228

Limit (cost=0.56..5.38 rows=2 width=226) (actual time=0.081..0.086 rows=2 loops=168,228)

16. 14,299.380 14,299.380 ↑ 9.5 2 168,228

Index Scan Backward using idx_blog_comments_numbers on comments bc2 (cost=0.56..46.33 rows=19 width=226) (actual time=0.081..0.085 rows=2 loops=168,228)

  • Index Cond: (id_post = bc1.id_post)
  • Filter: (id_parent <> 0)
  • Rows Removed by Filter: 12
Planning time : 3.607 ms
Execution time : 18,192.021 ms