explain.depesz.com

PostgreSQL's explain analyze made readable

Result: p6hH

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 523.474 ↓ 10.0 20 1

Limit (cost=31,347.36..31,347.36 rows=2 width=1,258) (actual time=523.468..523.474 rows=20 loops=1)

  • Buffers: shared hit=337,893
2. 10.086 523.468 ↓ 10.0 20 1

Sort (cost=31,347.36..31,347.36 rows=2 width=1,258) (actual time=523.466..523.468 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=337,893
3. 3.966 513.382 ↓ 3,174.5 6,349 1

Nested Loop Left Join (cost=1,420.62..31,347.35 rows=2 width=1,258) (actual time=29.336..513.382 rows=6,349 loops=1)

  • Buffers: shared hit=337,893
4. 9.565 496.718 ↓ 3,174.5 6,349 1

Nested Loop Left Join (cost=1,420.20..31,346.46 rows=2 width=1,252) (actual time=29.329..496.718 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=323,533
5. 10.787 474.445 ↓ 3,174.5 6,349 1

Nested Loop Semi Join (cost=1,419.76..31,338.26 rows=2 width=1,256) (actual time=29.301..474.445 rows=6,349 loops=1)

  • Buffers: shared hit=298,131
6. 22.442 147.300 ↓ 16.8 45,194 1

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

  • Buffers: shared hit=56,611
7. 0.286 8.357 ↑ 1.7 979 1

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

  • Buffers: shared hit=6,367
8. 0.132 1.571 ↑ 1.3 125 1

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

  • Group Key: namespaces.id
  • Buffers: shared hit=627
9. 1.439 1.439 ↑ 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.030..1.439 rows=125 loops=1)

  • Buffers: shared hit=627
10.          

CTE base_and_descendants

11. 0.317 1.279 ↑ 1.3 125 1

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

  • Buffers: shared hit=627
12. 0.022 0.022 ↑ 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.021..0.022 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
13. 0.165 0.940 ↓ 1.6 25 5

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

  • Buffers: shared hit=623
14. 0.025 0.025 ↓ 2.5 25 5

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

15. 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
16. 2.584 6.500 ↑ 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.010..0.052 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
17.          

SubPlan (for Index Scan)

18. 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
19. 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
20. 116.501 116.501 ↑ 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.119 rows=46 loops=979)

  • Index Cond: ((issues.project_id = projects.id) AND (issues.state_id = 1))
  • Buffers: shared hit=50,244
21. 316.358 316.358 ↓ 0.0 0 45,194

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

  • Index Cond: ((label_links.target_id = issues.id) AND (label_links.target_type = 'Issue'::text))
  • Heap Fetches: 1,573
  • 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: 4
  • Buffers: shared hit=241,520
22. 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
23.          

SubPlan (for Nested Loop Left Join)

24. 0.010 0.010 ↑ 1.0 1 1

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.009..0.010 rows=1 loops=1)

  • 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: 1
  • Buffers: shared hit=6
25. 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
26. 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