explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1n0G : Optimization for: plan #3nEs

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.003 418.976 ↑ 1.0 10 1

Limit (cost=270,876.08..270,876.10 rows=10 width=76) (actual time=418.974..418.976 rows=10 loops=1)

  • Planning time: 1.116 ms
  • Execution time: 419.164 ms
2.          

CTE ct

3. 0.064 418.926 ↑ 1.2 16 1

Recursive Union (cost=0.42..270,875.24 rows=20 width=77) (actual time=0.880..418.926 rows=16 loops=1)

4. 0.005 0.886 ↑ 1.0 10 1

Limit (cost=0.42..0.84 rows=10 width=77) (actual time=0.870..0.886 rows=10 loops=1)

5. 0.881 0.881 ↑ 100,001.0 10 1

Index Scan using "ind-remove" on comment (cost=0.42..41,817.60 rows=1,000,010 width=77) (actual time=0.869..0.881 rows=10 loops=1)

  • Filter: ((parent_id IS NULL) AND (deleted_date IS NULL) AND (website_page_id = 1))
  • Rows Removed by Filter: 6
6. 205.672 417.976 ↓ 2.0 2 4

Hash Join (cost=3.25..27,087.40 rows=1 width=77) (actual time=23.096..104.494 rows=2 loops=4)

  • Hash Cond: (comment_1.parent_id = ct_1.id)
7. 212.276 212.276 ↑ 1.0 1,000,010 4

Seq Scan on comment comment_1 (cost=0.00..23,334.10 rows=1,000,010 width=73) (actual time=0.004..53.069 rows=1,000,010 loops=4)

8. 0.012 0.028 ↑ 25.0 4 4

Hash (cost=2.00..2.00 rows=100 width=12) (actual time=0.007..0.007 rows=4 loops=4)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.016 0.016 ↑ 25.0 4 4

WorkTable Scan on ct ct_1 (cost=0.00..2.00 rows=100 width=12) (actual time=0.002..0.004 rows=4 loops=4)

10. 0.026 418.973 ↑ 2.0 10 1

Sort (cost=0.83..0.88 rows=20 width=76) (actual time=418.972..418.973 rows=10 loops=1)

  • Sort Key: ct.created_date DESC
  • Sort Method: quicksort Memory: 27kB
11. 418.947 418.947 ↑ 1.2 16 1

CTE Scan on ct (cost=0.00..0.40 rows=20 width=76) (actual time=0.883..418.947 rows=16 loops=1)