explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6sSb

Settings
# exclusive inclusive rows x rows loops node
1. 0.756 484.487 ↓ 455.0 455 1

GroupAggregate (cost=1,750.70..1,750.72 rows=1 width=16) (actual time=483.364..484.487 rows=455 loops=1)

  • Group Key: labels.id, (date(issues.created_at))
2. 2.715 483.731 ↓ 5,049.0 5,049 1

Sort (cost=1,750.70..1,750.70 rows=1 width=12) (actual time=483.353..483.731 rows=5,049 loops=1)

  • Sort Key: labels.id, (date(issues.created_at))
  • Sort Method: quicksort Memory: 429kB
3. 2.335 481.016 ↓ 5,049.0 5,049 1

Hash Semi Join (cost=1,267.97..1,750.69 rows=1 width=12) (actual time=1.312..481.016 rows=5,049 loops=1)

  • Hash Cond: (projects.namespace_id = namespaces.id)
4. 3.740 477.915 ↓ 5,052.0 5,052 1

Nested Loop Left Join (cost=2.18..484.89 rows=1 width=20) (actual time=0.531..477.915 rows=5,052 loops=1)

  • Filter: ((project_features.issues_access_level IS NULL) OR (project_features.issues_access_level = ANY ('{20,30}'::integer[])) OR ((project_features.issues_access_level = 10) AND (alternatives: SubPlan 7 or hashed SubPlan 8)))
5. 2.226 464.025 ↓ 5,052.0 5,052 1

Nested Loop (cost=1.75..480.79 rows=1 width=24) (actual time=0.520..464.025 rows=5,052 loops=1)

6. 22.751 431.487 ↓ 5,052.0 5,052 1

Nested Loop (cost=1.31..476.44 rows=1 width=20) (actual time=0.481..431.487 rows=5,052 loops=1)

7. 5.714 112.984 ↓ 4,107.7 49,292 1

Nested Loop (cost=0.87..384.60 rows=12 width=8) (actual time=0.041..112.984 rows=49,292 loops=1)

8. 0.086 0.086 ↑ 1.0 6 1

Index Only Scan using labels_pkey on labels (cost=0.43..13.21 rows=6 width=4) (actual time=0.014..0.086 rows=6 loops=1)

  • Index Cond: (id = ANY ('{2731248,10230929,4116705,2492649,2278648,2779806}'::integer[]))
  • Heap Fetches: 1
9. 107.184 107.184 ↓ 114.1 8,215 6

Index Scan using index_label_links_on_label_id on label_links (cost=0.44..61.18 rows=72 width=8) (actual time=0.020..17.864 rows=8,215 loops=6)

  • Index Cond: (label_id = labels.id)
  • Filter: ((target_type)::text = 'Issue'::text)
  • Rows Removed by Filter: 3080
10. 293.790 295.752 ↓ 0.0 0 49,292

Index Scan using issues_pkey on issues (cost=0.44..7.64 rows=1 width=16) (actual time=0.006..0.006 rows=0 loops=49,292)

  • Index Cond: (id = label_links.target_id)
  • Filter: ((created_at <= '2019-08-01 00:00:00+00'::timestamp with time zone) AND (created_at >= '2019-05-01 00:00:00+00'::timestamp with time zone) AND ((confidential IS NOT TRUE) OR (confidential AND ((author_id = 4156052) OR (alternatives: SubPlan 1 or hashed SubPlan 2) OR (alternatives: SubPlan 3 or hashed SubPlan 4)))))
  • Rows Removed by Filter: 1
11.          

SubPlan (forIndex Scan)

12. 1.314 1.314 ↓ 0.0 0 219

Index Only Scan using index_issue_assignees_on_issue_id_and_user_id on issue_assignees (cost=0.43..3.45 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=219)

  • Index Cond: ((issue_id = issues.id) AND (user_id = 4156052))
  • Heap Fetches: 3
13. 0.000 0.000 ↓ 0.0 0

Index Scan using index_issue_assignees_on_user_id on issue_assignees issue_assignees_1 (cost=0.43..69.48 rows=65 width=4) (never executed)

  • Index Cond: (user_id = 4156052)
14. 0.648 0.648 ↑ 1.0 1 216

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations (cost=0.56..3.59 rows=1 width=0) (actual time=0.003..0.003 rows=1 loops=216)

  • Index Cond: ((user_id = 4156052) AND (project_id = issues.project_id) AND (access_level >= 20))
  • Heap Fetches: 133
15. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations project_authorizations_1 (cost=0.56..689.86 rows=2,132 width=4) (never executed)

  • Index Cond: ((user_id = 4156052) AND (access_level >= 20))
  • Heap Fetches: 0
16. 20.208 30.312 ↑ 1.0 1 5,052

Index Scan using projects_pkey on projects (cost=0.43..4.34 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=5,052)

  • Index Cond: (id = issues.project_id)
  • Filter: ((alternatives: SubPlan 5 or hashed SubPlan 6) OR (visibility_level = ANY ('{10,20}'::integer[])))
17.          

SubPlan (forIndex Scan)

18. 10.104 10.104 ↑ 1.0 1 5,052

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations project_authorizations_2 (cost=0.56..3.59 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=5,052)

  • Index Cond: ((user_id = 4156052) AND (project_id = projects.id) AND (access_level >= 10))
  • Heap Fetches: 3466
19. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations project_authorizations_3 (cost=0.56..731.99 rows=2,274 width=4) (never executed)

  • Index Cond: ((user_id = 4156052) AND (access_level >= 10))
  • Heap Fetches: 0
20. 10.104 10.104 ↑ 1.0 1 5,052

Index Scan using index_project_features_on_project_id on project_features (cost=0.43..0.49 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=5,052)

  • Index Cond: (projects.id = project_id)
21.          

SubPlan (forNested Loop Left Join)

22. 0.046 0.046 ↑ 1.0 1 23

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations project_authorizations_4 (cost=0.56..3.59 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=23)

  • Index Cond: ((user_id = 4156052) AND (project_id = projects.id) AND (access_level >= 10))
  • Heap Fetches: 2
23. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations project_authorizations_5 (cost=0.56..731.99 rows=2,274 width=4) (never executed)

  • Index Cond: ((user_id = 4156052) AND (access_level >= 10))
  • Heap Fetches: 0
24. 0.015 0.766 ↑ 2.0 65 1

Hash (cost=1,264.16..1,264.16 rows=131 width=4) (actual time=0.766..0.766 rows=65 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
25. 0.751 0.751 ↑ 2.0 65 1

CTE Scan on base_and_descendants namespaces (cost=1,260.23..1,262.85 rows=131 width=4) (actual time=0.030..0.751 rows=65 loops=1)

26.          

CTE base_and_descendants

27. 0.143 0.659 ↑ 2.0 65 1

Recursive Union (cost=0.43..1,260.23 rows=131 width=322) (actual time=0.027..0.659 rows=65 loops=1)

28. 0.016 0.016 ↑ 1.0 1 1

Index Scan using namespaces_pkey on namespaces namespaces_1 (cost=0.43..3.45 rows=1 width=322) (actual time=0.015..0.016 rows=1 loops=1)

  • Index Cond: (id = 9970)
  • Filter: ((type)::text = 'Group'::text)
29. 0.035 0.500 ↑ 1.0 13 5

Nested Loop (cost=0.43..125.42 rows=13 width=322) (actual time=0.019..0.100 rows=13 loops=5)

30. 0.010 0.010 ↓ 1.3 13 5

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

31. 0.455 0.455 ↑ 1.0 1 65

Index Scan using index_namespaces_on_parent_id_and_id on namespaces namespaces_2 (cost=0.43..12.51 rows=1 width=322) (actual time=0.005..0.007 rows=1 loops=65)

  • Index Cond: (parent_id = base_and_descendants.id)
  • Filter: ((type)::text = 'Group'::text)
Planning time : 4.007 ms
Execution time : 485.101 ms