explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tg5R

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 2.523 ↑ 1.0 1 1

Aggregate (cost=1,291.25..1,291.26 rows=1 width=8) (actual time=2.523..2.523 rows=1 loops=1)

2. 0.000 2.521 ↓ 0.0 0 1

Nested Loop (cost=1,278.37..1,291.21 rows=16 width=0) (actual time=2.521..2.521 rows=0 loops=1)

3. 0.001 2.521 ↓ 0.0 0 1

Unique (cost=1,277.93..1,287.33 rows=1 width=4) (actual time=2.521..2.521 rows=0 loops=1)

4.          

CTE base_and_descendants

5. 0.413 2.290 ↓ 1.7 228 1

Recursive Union (cost=1.43..1,277.23 rows=131 width=322) (actual time=0.185..2.290 rows=228 loops=1)

6. 0.011 0.323 ↓ 2.0 2 1

Nested Loop Semi Join (cost=1.43..21.06 rows=1 width=322) (actual time=0.174..0.323 rows=2 loops=1)

7. 0.003 0.263 ↓ 7.0 7 1

Nested Loop (cost=0.87..20.27 rows=1 width=326) (actual time=0.093..0.263 rows=7 loops=1)

8. 0.190 0.190 ↓ 7.0 7 1

Index Scan using index_members_on_user_id on members (cost=0.43..16.80 rows=1 width=4) (actual time=0.079..0.190 rows=7 loops=1)

  • Index Cond: (user_id = 2535118)
  • Filter: ((requested_at IS NULL) AND (access_level >= 30) AND ((type)::text = 'GroupMember'::text) AND ((source_type)::text = 'Namespace'::text))
  • Rows Removed by Filter: 58
9. 0.070 0.070 ↑ 1.0 1 7

Index Scan using namespaces_pkey on namespaces namespaces_2 (cost=0.43..3.45 rows=1 width=322) (actual time=0.010..0.010 rows=1 loops=7)

  • Index Cond: (id = members.source_id)
  • Filter: ((type)::text = 'Group'::text)
10. 0.000 0.049 ↓ 0.0 0 7

Nested Loop (cost=0.56..0.68 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=7)

11. 0.042 0.042 ↓ 0.0 0 7

Index Scan using index_gitlab_subscriptions_on_namespace_id on gitlab_subscriptions (cost=0.43..0.51 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=7)

  • Index Cond: (namespace_id = namespaces_2.id)
12. 0.008 0.008 ↑ 1.0 1 2

Index Scan using plans_pkey on plans (cost=0.13..0.15 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=2)

  • Index Cond: (id = gitlab_subscriptions.hosted_plan_id)
  • Filter: ((name)::text = ANY ('{silver,gold}'::text[]))
13. 0.165 1.554 ↓ 2.5 32 7

Nested Loop (cost=0.43..125.35 rows=13 width=322) (actual time=0.024..0.222 rows=32 loops=7)

14. 0.021 0.021 ↓ 3.3 33 7

WorkTable Scan on base_and_descendants (cost=0.00..0.20 rows=10 width=4) (actual time=0.000..0.003 rows=33 loops=7)

15. 1.368 1.368 ↑ 1.0 1 228

Index Scan using index_namespaces_on_parent_id_and_id on namespaces namespaces_3 (cost=0.43..12.51 rows=1 width=322) (actual time=0.004..0.006 rows=1 loops=228)

  • Index Cond: (parent_id = base_and_descendants.id)
  • Filter: ((type)::text = 'Group'::text)
16. 0.000 2.520 ↓ 0.0 0 1

Nested Loop (cost=0.71..10.10 rows=1 width=4) (actual time=2.520..2.520 rows=0 loops=1)

17. 0.002 2.520 ↓ 0.0 0 1

Nested Loop (cost=0.27..6.25 rows=1 width=4) (actual time=2.520..2.520 rows=0 loops=1)

  • Join Filter: (namespaces.parent_id = namespaces_1.id)
18. 2.511 2.511 ↑ 1.0 1 1

CTE Scan on base_and_descendants namespaces (cost=0.00..2.95 rows=1 width=8) (actual time=0.212..2.511 rows=1 loops=1)

  • Filter: (id = 9970)
  • Rows Removed by Filter: 227
19. 0.007 0.007 ↓ 0.0 0 1

Index Scan using index_namespaces_on_custom_project_templates_group_id_and_type on namespaces namespaces_1 (cost=0.27..3.29 rows=1 width=8) (actual time=0.007..0.007 rows=0 loops=1)

  • Index Cond: ((custom_project_templates_group_id = 9970) AND ((type)::text = 'Group'::text))
20. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_projects_on_namespace_id on projects projects_1 (cost=0.43..3.70 rows=15 width=4) (never executed)

  • Index Cond: (namespace_id = 9970)
  • Heap Fetches: 0
21. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_projects_on_namespace_id on projects (cost=0.43..3.72 rows=16 width=4) (never executed)

  • Index Cond: (namespace_id = namespaces.id)
  • Heap Fetches: 0
Planning time : 2.116 ms
Execution time : 2.802 ms