explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4Drx

Settings
# exclusive inclusive rows x rows loops node
1. 2,471.559 2,471.559 ↑ 17.7 1,000,009 1

CTE Scan on ct (cost=20,290,096.66..20,643,281.18 rows=17,659,226 width=76) (actual time=0.034..2,471.559 rows=1,000,009 loops=1)

2.          

CTE ct

3. 247.843 2,200.692 ↑ 17.7 1,000,009 1

Recursive Union (cost=0.00..20,290,096.66 rows=17,659,226 width=76) (actual time=0.030..2,200.692 rows=1,000,009 loops=1)

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

Seq Scan on comment c1 (cost=0.00..25,834.11 rows=999,976 width=76) (actual time=0.026..156.217 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: 5
5. 2.612 1,796.632 ↑ 1,665,925.0 1 4

Merge Join (cost=1,909,455.29..1,991,107.80 rows=1,665,925 width=76) (actual time=449.157..449.158 rows=1 loops=4)

  • Merge Cond: (ct_1.id = comment.parent_id)
6. 356.412 478.976 ↑ 4,999,880.0 2 4

Sort (cost=1,704,429.40..1,729,428.80 rows=9,999,760 width=12) (actual time=119.744..119.744 rows=2 loops=4)

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

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

8. 0.012 1,315.044 ↑ 166,668.2 6 4

Materialize (cost=205,025.89..210,025.94 rows=1,000,009 width=72) (actual time=328.760..328.761 rows=6 loops=4)

9. 827.868 1,315.032 ↑ 166,668.2 6 4

Sort (cost=205,025.89..207,525.92 rows=1,000,009 width=72) (actual time=328.758..328.758 rows=6 loops=4)

  • Sort Key: comment.parent_id
  • Sort Method: external sort Disk: 80240kB
10. 487.164 487.164 ↑ 1.0 1,000,009 4

Seq Scan on comment (cost=0.00..23,334.09 rows=1,000,009 width=72) (actual time=0.011..121.791 rows=1,000,009 loops=4)

Planning time : 0.673 ms
Execution time : 2,514.421 ms