explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YaHm

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 1,412.638 ↑ 1.0 20 1

Limit (cost=33,748.93..33,748.98 rows=20 width=1,258) (actual time=1,412.633..1,412.638 rows=20 loops=1)

  • Buffers: shared hit=1,366,380
2. 11.642 1,412.633 ↑ 13.8 20 1

Sort (cost=33,748.93..33,749.62 rows=276 width=1,258) (actual time=1,412.631..1,412.633 rows=20 loops=1)

  • Sort Key: ((milestones.due_date IS NULL)), ((milestones.id IS NULL)), milestones.due_date DESC, issues.id DESC
  • Sort Method: top-N heapsort Memory: 93kB
  • Buffers: shared hit=1,366,380
3. 5.475 1,400.991 ↓ 23.0 6,349 1

Nested Loop Left Join (cost=1,421.06..33,741.58 rows=276 width=1,258) (actual time=38.754..1,400.991 rows=6,349 loops=1)

  • Buffers: shared hit=1,366,380
4. 11.875 1,382.818 ↓ 23.0 6,349 1

Nested Loop Left Join (cost=1,420.63..33,618.90 rows=276 width=1,252) (actual time=38.747..1,382.818 rows=6,349 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 3 or hashed SubPlan 4)))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=1,352,020
5. 0.000 1,356.867 ↓ 22.0 6,349 1

Nested Loop (cost=1,420.20..32,438.48 rows=288 width=1,256) (actual time=38.721..1,356.867 rows=6,349 loops=1)

  • Buffers: shared hit=1,325,377
6. 155.127 647.080 ↓ 88.7 238,303 1

Nested Loop (cost=1,419.76..31,199.13 rows=2,686 width=1,260) (actual time=1.400..647.080 rows=238,303 loops=1)

  • Buffers: shared hit=371,990
7. 22.627 130.401 ↓ 16.8 45,194 1

Nested Loop (cost=1,419.20..29,379.51 rows=2,697 width=1,256) (actual time=1.368..130.401 rows=45,194 loops=1)

  • Buffers: shared hit=56,611
8. 0.377 7.916 ↑ 1.7 979 1

Nested Loop (cost=1,418.63..16,399.75 rows=1,633 width=4) (actual time=1.353..7.916 rows=979 loops=1)

  • Buffers: shared hit=6,367
9. 0.132 1.414 ↑ 1.3 125 1

HashAggregate (cost=1,418.20..1,419.81 rows=161 width=4) (actual time=1.328..1.414 rows=125 loops=1)

  • Group Key: namespaces.id
  • Buffers: shared hit=627
10. 1.282 1.282 ↑ 1.3 125 1

CTE Scan on base_and_descendants namespaces (cost=1,412.97..1,416.19 rows=161 width=4) (actual time=0.028..1.282 rows=125 loops=1)

  • Buffers: shared hit=627
11.          

CTE base_and_descendants

12. 0.279 1.133 ↑ 1.3 125 1

Recursive Union (cost=0.43..1,412.97 rows=161 width=329) (actual time=0.025..1.133 rows=125 loops=1)

  • Buffers: shared hit=627
13. 0.019 0.019 ↑ 1.0 1 1

Index Scan using namespaces_pkey on public.namespaces namespaces_1 (cost=0.43..3.45 rows=1 width=329) (actual time=0.019..0.019 rows=1 loops=1)

  • Index Cond: (namespaces_1.id = 9,970)
  • Filter: ((namespaces_1.type)::text = 'Group'::text)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=4
14. 0.065 0.835 ↓ 1.6 25 5

Nested Loop (cost=0.56..140.63 rows=16 width=329) (actual time=0.014..0.167 rows=25 loops=5)

  • Buffers: shared hit=623
15. 0.020 0.020 ↓ 2.5 25 5

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

16. 0.750 0.750 ↑ 2.0 1 125

Index Scan using index_namespaces_on_parent_id_and_id on public.namespaces namespaces_2 (cost=0.56..14.02 rows=2 width=329) (actual time=0.004..0.006 rows=1 loops=125)

  • Index Cond: (namespaces_2.parent_id = base_and_descendants.id)
  • Filter: ((namespaces_2.type)::text = 'Group'::text)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=623
17. 2.209 6.125 ↑ 1.2 8 125

Index Scan using index_projects_on_namespace_id_and_id on public.projects (cost=0.43..92.94 rows=10 width=8) (actual time=0.009..0.049 rows=8 loops=125)

  • Index Cond: (projects.namespace_id = namespaces.id)
  • Filter: ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (projects.visibility_level = ANY ('{10,20}'::integer[])))
  • Rows Removed by Filter: 0
  • Buffers: shared hit=5,740
18.          

SubPlan (for Index Scan)

19. 3.916 3.916 ↑ 1.0 1 979

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on public.project_authorizations (cost=0.57..3.59 rows=1 width=0) (actual time=0.004..0.004 rows=1 loops=979)

  • Index Cond: ((project_authorizations.user_id = 4,156,052) AND (project_authorizations.project_id = projects.id) AND (project_authorizations.access_level >= 10))
  • Heap Fetches: 113
  • Buffers: shared hit=4,383
20. 0.000 0.000 ↓ 0.0 0 0

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on public.project_authorizations project_authorizations_1 (cost=0.57..272.02 rows=1,222 width=4) (actual time=0.000..0.000 rows=0 loops=0)

  • Index Cond: ((project_authorizations_1.user_id = 4,156,052) AND (project_authorizations_1.access_level >= 10))
  • Heap Fetches: 0
21. 99.858 99.858 ↑ 3.8 46 979

Index Scan using idx_issues_on_project_id_and_rel_position_and_state_id_and_id on public.issues (cost=0.56..6.18 rows=177 width=1,252) (actual time=0.010..0.102 rows=46 loops=979)

  • Index Cond: ((issues.project_id = projects.id) AND (issues.state_id = 1))
  • Buffers: shared hit=50,244
22. 361.552 361.552 ↓ 2.5 5 45,194

Index Scan using index_label_links_on_target_id_and_target_type on public.label_links (cost=0.56..0.65 rows=2 width=8) (actual time=0.005..0.008 rows=5 loops=45,194)

  • Index Cond: ((label_links.target_id = issues.id) AND ((label_links.target_type)::text = 'Issue'::text))
  • Buffers: shared hit=315,379
23. 714.909 714.909 ↓ 0.0 0 238,303

Index Scan using labels_pkey on public.labels (cost=0.43..0.46 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=238,303)

  • Index Cond: (labels.id = label_links.label_id)
  • Filter: ((labels.title)::text = 'bug'::text)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=953,387
24. 12.698 12.698 ↑ 1.0 1 6,349

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

  • Index Cond: (projects.id = project_features.project_id)
  • Buffers: shared hit=25,396
25.          

SubPlan (for Nested Loop Left Join)

26. 0.000 0.000 ↓ 0.0 0 0

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on public.project_authorizations project_authorizations_2 (cost=0.57..3.59 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=0)

  • Index Cond: ((project_authorizations_2.user_id = 4,156,052) AND (project_authorizations_2.project_id = projects.id) AND (project_authorizations_2.access_level >= 10))
  • Heap Fetches: 0
27. 1.378 1.378 ↓ 2.6 3,160 1

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on public.project_authorizations project_authorizations_3 (cost=0.57..272.02 rows=1,222 width=4) (actual time=0.042..1.378 rows=3,160 loops=1)

  • Index Cond: ((project_authorizations_3.user_id = 4,156,052) AND (project_authorizations_3.access_level >= 10))
  • Heap Fetches: 458
  • Buffers: shared hit=1,247
28. 12.698 12.698 ↑ 1.0 1 6,349

Index Scan using milestones_pkey on public.milestones (cost=0.42..0.44 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=6,349)

  • Index Cond: (issues.milestone_id = milestones.id)
  • Buffers: shared hit=14,360