explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3nEs

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.004 401.623 ↑ 1.0 10 1

Limit (cost=270,899.79..270,899.82 rows=10 width=76) (actual time=401.620..401.623 rows=10 loops=1)

  • Planning time: 0.868 ms
  • Execution time: 401.756 ms
2.          

CTE ct

3. 0.061 401.529 ↑ 21.2 16 1

Recursive Union (cost=0.42..270,885.64 rows=340 width=76) (actual time=0.054..401.529 rows=16 loops=1)

4. 0.005 0.064 ↑ 1.0 10 1

Limit (cost=0.42..0.84 rows=10 width=76) (actual time=0.044..0.064 rows=10 loops=1)

5. 0.059 0.059 ↑ 99,997.7 10 1

Index Scan Backward using "ind-remove-x2" on comment (cost=0.42..41,833.60 rows=999,977 width=76) (actual time=0.044..0.059 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. 146.352 401.404 ↑ 16.5 2 4

Hash Join (cost=3.25..27,087.80 rows=33 width=76) (actual time=23.987..100.351 rows=2 loops=4)

  • Hash Cond: (comment_1.parent_id = ct_1.id)
7. 255.024 255.024 ↑ 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.006..63.756 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.027 401.619 ↑ 34.0 10 1

Sort (cost=14.15..15.00 rows=340 width=76) (actual time=401.618..401.619 rows=10 loops=1)

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

CTE Scan on ct (cost=0.00..6.80 rows=340 width=76) (actual time=0.058..401.592 rows=16 loops=1)