explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zITV

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 3,099.301 ↑ 1.0 10 1

Limit (cost=21,024,979.19..21,024,979.22 rows=10 width=76) (actual time=3,099.299..3,099.301 rows=10 loops=1)

2.          

CTE ct

3. 629.598 2,737.732 ↑ 17.7 1,000,010 1

Recursive Union (cost=0.00..20,290,183.86 rows=17,659,257 width=76) (actual time=0.038..2,737.732 rows=1,000,010 loops=1)

4. 160.910 160.910 ↓ 1.0 1,000,004 1

Seq Scan on comment (cost=0.00..25,834.12 rows=999,977 width=76) (actual time=0.029..160.910 rows=1,000,004 loops=1)

  • Filter: ((parent_id IS NULL) AND (deleted_date IS NULL) AND (website_page_id = 1))
  • Rows Removed by Filter: 6
5. 14.148 1,947.224 ↑ 832,964.0 2 4

Merge Join (cost=1,909,463.84..1,991,116.46 rows=1,665,928 width=76) (actual time=486.804..486.806 rows=2 loops=4)

  • Merge Cond: (ct_1.id = comment_1.parent_id)
6. 354.544 478.924 ↑ 3,333,256.7 3 4

Sort (cost=1,704,437.83..1,729,437.26 rows=9,999,770 width=12) (actual time=119.731..119.731 rows=3 loops=4)

  • Sort Key: ct_1.id
  • Sort Method: quicksort Memory: 25kB
7. 124.380 124.380 ↑ 40.0 250,002 4

WorkTable Scan on ct ct_1 (cost=0.00..199,995.40 rows=9,999,770 width=12) (actual time=0.004..31.095 rows=250,002 loops=4)

8. 0.016 1,454.152 ↑ 166,668.3 6 4

Materialize (cost=205,026.01..210,026.06 rows=1,000,010 width=72) (actual time=363.537..363.538 rows=6 loops=4)

9. 917.204 1,454.136 ↑ 166,668.3 6 4

Sort (cost=205,026.01..207,526.04 rows=1,000,010 width=72) (actual time=363.534..363.534 rows=6 loops=4)

  • Sort Key: comment_1.parent_id
  • Sort Method: external sort Disk: 80240kB
10. 536.932 536.932 ↑ 1.0 1,000,010 4

Seq Scan on comment comment_1 (cost=0.00..23,334.10 rows=1,000,010 width=72) (actual time=0.008..134.233 rows=1,000,010 loops=4)

11. 92.901 3,099.298 ↑ 1,765,925.7 10 1

Sort (cost=734,795.33..778,943.48 rows=17,659,257 width=76) (actual time=3,099.297..3,099.298 rows=10 loops=1)

  • Sort Key: ct.created_date DESC
  • Sort Method: top-N heapsort Memory: 26kB
12. 3,006.397 3,006.397 ↑ 17.7 1,000,010 1

CTE Scan on ct (cost=0.00..353,185.14 rows=17,659,257 width=76) (actual time=0.041..3,006.397 rows=1,000,010 loops=1)

Planning time : 1.167 ms
Execution time : 3,128.266 ms