explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gSl

Settings
# exclusive inclusive rows x rows loops node
1. 0.100 64.071 ↓ 2.0 2 1

Aggregate (cost=2,058.61..2,058.63 rows=1 width=10) (actual time=63.938..64.071 rows=2 loops=1)

  • Group Key: issues.state_id
  • Buffers: shared hit=36,202
2. 0.875 63.971 ↓ 444.0 444 1

Sort (cost=2,058.61..2,058.62 rows=1 width=2) (actual time=63.926..63.971 rows=444 loops=1)

  • Sort Key: issues.state_id
  • Sort Method: quicksort Memory: 45kB
  • Buffers: shared hit=36,202
3. 0.907 63.096 ↓ 444.0 444 1

Nested Loop Semi Join (cost=1,471.56..2,058.60 rows=1 width=2) (actual time=4.482..63.096 rows=444 loops=1)

  • Buffers: shared hit=36,202
4. 1.692 54.426 ↓ 1,109.0 1,109 1

Nested Loop Semi Join (cost=1,471.00..2,057.73 rows=1 width=14) (actual time=4.395..54.426 rows=1,109 loops=1)

  • Buffers: shared hit=30,107
5. 1.403 49.404 ↓ 1,110.0 1,110 1

Nested Loop Left Join (cost=58.03..637.92 rows=1 width=18) (actual time=4.362..49.404 rows=1,110 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=29,480
6. 1.274 42.925 ↓ 1,110.0 1,110 1

Nested Loop (cost=57.60..633.82 rows=1 width=22) (actual time=4.347..42.925 rows=1,110 loops=1)

  • Buffers: shared hit=24,318
7. 1.129 30.551 ↓ 1,110.0 1,110 1

Nested Loop Semi Join (cost=57.16..629.75 rows=1 width=18) (actual time=4.319..30.551 rows=1,110 loops=1)

  • Buffers: shared hit=14,793
8. 0.851 18.325 ↓ 9.0 1,233 1

Nested Loop (cost=56.60..548.21 rows=137 width=14) (actual time=4.303..18.325 rows=1,233 loops=1)

  • Buffers: shared hit=8,844
9. 1.348 5.144 ↓ 9.0 1,233 1

HashAggregate (cost=56.03..57.40 rows=137 width=4) (actual time=4.284..5.144 rows=1,233 loops=1)

  • Group Key: label_links_1.target_id
  • Buffers: shared hit=2,679
10. 3.796 3.796 ↓ 9.0 1,233 1

Index Scan using index_label_links_on_label_id on public.label_links label_links_1 (cost=0.56..55.69 rows=137 width=4) (actual time=0.028..3.796 rows=1,233 loops=1)

  • Index Cond: (label_links_1.label_id = 3,005,495)
  • Filter: ((label_links_1.target_type)::text = 'Issue'::text)
  • Rows Removed by Filter: 1,481
  • Buffers: shared hit=2,679
11. 12.330 12.330 ↑ 1.0 1 1,233

Index Scan using issues_pkey on public.issues (cost=0.56..3.58 rows=1 width=10) (actual time=0.010..0.010 rows=1 loops=1,233)

  • Index Cond: (issues.id = label_links_1.target_id)
  • Buffers: shared hit=6,165
12. 11.097 11.097 ↑ 1.0 1 1,233

Index Only Scan using index_on_label_links_all_columns on public.label_links label_links_2 (cost=0.56..0.60 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1,233)

  • Index Cond: ((label_links_2.target_id = issues.id) AND (label_links_2.label_id = 2,278,656) AND (label_links_2.target_type = 'Issue'::text))
  • Heap Fetches: 19
  • Buffers: shared hit=5,949
13. 5.550 11.100 ↑ 1.0 1 1,110

Index Scan using projects_pkey on public.projects (cost=0.43..4.07 rows=1 width=8) (actual time=0.010..0.010 rows=1 loops=1,110)

  • Index Cond: (projects.id = issues.project_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=9,525
14.          

SubPlan (for Index Scan)

15. 5.550 5.550 ↑ 1.0 1 1,110

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.005..0.005 rows=1 loops=1,110)

  • Index Cond: ((project_authorizations.user_id = 4,156,052) AND (project_authorizations.project_id = projects.id) AND (project_authorizations.access_level >= 10))
  • Heap Fetches: 0
  • Buffers: shared hit=5,085
16. 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
17. 4.440 4.440 ↑ 1.0 1 1,110

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.004..0.004 rows=1 loops=1,110)

  • Index Cond: (projects.id = project_features.project_id)
  • Buffers: shared hit=4,440
18.          

SubPlan (for Nested Loop Left Join)

19. 0.636 0.636 ↑ 1.0 1 159

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.004..0.004 rows=1 loops=159)

  • 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
  • Buffers: shared hit=722
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_3 (cost=0.57..272.02 rows=1,222 width=4) (actual time=0.000..0.000 rows=0 loops=0)

  • Index Cond: ((project_authorizations_3.user_id = 4,156,052) AND (project_authorizations_3.access_level >= 10))
  • Heap Fetches: 0
21. 3.330 3.330 ↑ 32.2 5 1,110

CTE Scan on base_and_descendants namespaces (cost=1,412.97..1,416.19 rows=161 width=4) (actual time=0.001..0.003 rows=5 loops=1,110)

  • Buffers: shared hit=627
22.          

CTE base_and_descendants

23. 0.374 1.360 ↑ 1.3 125 1

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

  • Buffers: shared hit=627
24. 0.016 0.016 ↑ 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.015..0.016 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
25. 0.075 0.970 ↓ 1.6 25 5

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

  • Buffers: shared hit=623
26. 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.001..0.004 rows=25 loops=5)

27. 0.875 0.875 ↑ 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.005..0.007 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
28. 7.763 7.763 ↓ 0.0 0 1,109

Index Only Scan using index_on_label_links_all_columns on public.label_links (cost=0.56..0.72 rows=1 width=4) (actual time=0.007..0.007 rows=0 loops=1,109)

  • Index Cond: ((label_links.target_id = issues.id) AND (label_links.target_type = 'Issue'::text))
  • Heap Fetches: 47
  • Filter: (label_links.label_id = ANY ('{1924053,2191076,2229310,2251841,2278648,2379994,2414262,3519299,3791725,3892549,3892770,3899495,3969396,3999541,3999564,4007552,4007738,4049204,4057321,4063693,4117093,6190961,7142293,7157910,7256789,7717873,7841215,8761704,8827899,8828075,8828148,9084503,10778837,10778846,11602405,12073682,12932265,13682327,15339054}'::integer[]))
  • Rows Removed by Filter: 3
  • Buffers: shared hit=6,095