explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 0.122 ↑ 1.0 10 1

Limit (cost=8,474.90..8,474.93 rows=10 width=76) (actual time=0.120..0.122 rows=10 loops=1)

2.          

CTE ct

3. 0.012 0.094 ↑ 2.0 10 1

Recursive Union (cost=0.42..8,474.07 rows=20 width=77) (actual time=0.037..0.094 rows=10 loops=1)

4. 0.003 0.040 ↑ 1.0 10 1

Limit (cost=0.42..1.14 rows=10 width=77) (actual time=0.033..0.040 rows=10 loops=1)

5. 0.037 0.037 ↑ 100,000.0 10 1

Index Scan using index_comment_created_date_desc on comment (cost=0.42..71,942.43 rows=1,000,000 width=77) (actual time=0.032..0.037 rows=10 loops=1)

  • Filter: ((parent_id IS NULL) AND (deleted_date IS NULL) AND (website_page_id = 1))
6. 0.010 0.042 ↓ 0.0 0 1

Nested Loop (cost=0.42..847.25 rows=1 width=77) (actual time=0.042..0.042 rows=0 loops=1)

7. 0.002 0.002 ↑ 10.0 10 1

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

8. 0.030 0.030 ↓ 0.0 0 10

Index Scan using index_comment_parent_id on comment comment_1 (cost=0.42..8.44 rows=1 width=73) (actual time=0.003..0.003 rows=0 loops=10)

  • Index Cond: (parent_id = ct_1.id)
9. 0.019 0.120 ↑ 2.0 10 1

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

  • Sort Key: ct.created_date DESC
  • Sort Method: quicksort Memory: 26kB
10. 0.101 0.101 ↑ 2.0 10 1

CTE Scan on ct (cost=0.00..0.40 rows=20 width=76) (actual time=0.039..0.101 rows=10 loops=1)