explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YCxg

Settings
# exclusive inclusive rows x rows loops node
1. 3.588 3.588 ↑ 3.5 599 1

CTE Scan on cte_name (cost=4,626.93..4,668.29 rows=2,068 width=3,665) (actual time=0.052..3.588 rows=599 loops=1)

2.          

CTE cte_name

3. 0.157 2.537 ↑ 3.5 599 1

Nested Loop (cost=1,259.27..4,626.93 rows=2,068 width=601) (actual time=0.045..2.537 rows=599 loops=1)

4.          

CTE base_and_descendants

5. 0.027 0.484 ↑ 2.0 65 1

Recursive Union (cost=0.43..1,258.84 rows=131 width=8) (actual time=0.024..0.484 rows=65 loops=1)

6. 0.022 0.022 ↑ 1.0 1 1

Index Scan using namespaces_pkey on namespaces (cost=0.43..3.45 rows=1 width=8) (actual time=0.022..0.022 rows=1 loops=1)

  • Index Cond: (id = 9,970)
  • Filter: ((parent_id IS NULL) AND ((type)::text = 'Group'::text))
7. 0.040 0.435 ↑ 1.0 13 5

Nested Loop (cost=0.43..125.28 rows=13 width=8) (actual time=0.014..0.087 rows=13 loops=5)

8. 0.005 0.005 ↓ 1.3 13 5

WorkTable Scan on base_and_descendants (cost=0.00..0.20 rows=10 width=4) (actual time=0.000..0.001 rows=13 loops=5)

9. 0.390 0.390 ↓ 0.0 1 65

Index Scan using index_namespaces_on_parent_id_and_id on namespaces namespaces_1 (cost=0.43..12.50 rows=1width=8) (cost=0..0 rows=0 width=0) (actual time=0.005..0.006 rows=1 loops=65)

  • Index Cond: (parent_id = base_and_descendants.id)
  • Filter: ((type)::text = 'Group'::text)
10. 0.495 0.495 ↑ 2.0 65 1

CTE Scan on base_and_descendants namespaces_2 (cost=0.00..2.62 rows=131 width=4) (actual time=0.025..0.495 rows=65 loops=1)

11. 1.885 1.885 ↑ 1.8 9 65

Index Scan using index_projects_on_namespace_id on projects (cost=0.43..25.53 rows=16 width=601) (actual time=0.008..0.029 rows=9 loops=65)

  • Index Cond: (namespace_id = namespaces_2.id)
Planning time : 0.881 ms
Execution time : 3.821 ms