explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Vf1t

Settings
# exclusive inclusive rows x rows loops node
1. 9.748 327.028 ↓ 0.0 0 1

GroupAggregate (cost=95.08..95.15 rows=4 width=714) (actual time=327.028..327.028 rows=0 loops=1)

  • Group Key: merge_requests.id
  • Filter: (count(users.id) = 5)
  • Rows Removed by Filter: 17,643
2. 35.000 317.280 ↓ 4,421.2 17,685 1

Sort (cost=95.08..95.09 rows=4 width=718) (actual time=308.515..317.280 rows=17,685 loops=1)

  • Sort Key: merge_requests.id
  • Sort Method: quicksort Memory: 19,616kB
3. 9.825 282.280 ↓ 4,421.2 17,685 1

Nested Loop Left Join (cost=2.30..95.04 rows=4 width=718) (actual time=0.103..282.280 rows=17,685 loops=1)

  • Filter: ((project_features.merge_requests_access_level > 0) OR (project_features.merge_requests_access_level IS NULL))
4. 0.127 237.085 ↓ 4,421.2 17,685 1

Nested Loop (cost=1.86..93.09 rows=4 width=722) (actual time=0.090..237.085 rows=17,685 loops=1)

5. 0.000 148.533 ↓ 4,421.2 17,685 1

Nested Loop (cost=1.43..76.81 rows=4 width=718) (actual time=0.061..148.533 rows=17,685 loops=1)

6. 2.323 7.510 ↓ 4,421.2 17,685 1

Nested Loop (cost=0.86..71.11 rows=4 width=8) (actual time=0.044..7.510 rows=17,685 loops=1)

7. 0.157 0.157 ↑ 1.0 5 1

Index Scan using index_users_on_username on users (cost=0.43..17.25 rows=5 width=4) (actual time=0.021..0.157 rows=5 loops=1)

  • Index Cond: ((username)::text = ANY ('{drampelt,jrestrepoatfluid,ralvarezatfluid,Sundararajan,ll-sshinomiya}'::text[]))
8. 5.030 5.030 ↓ 42.1 3,537 5

Index Only Scan using index_approvals_on_user_id_and_merge_request_id on approvals (cost=0.43..9.93 rows=84 width=8) (actual time=0.020..1.006 rows=3,537 loops=5)

  • Index Cond: (user_id = users.id)
  • Heap Fetches: 867
9. 141.480 141.480 ↑ 1.0 1 17,685

Index Scan using merge_requests_pkey on merge_requests (cost=0.56..1.41 rows=1 width=714) (actual time=0.007..0.008 rows=1 loops=17,685)

  • Index Cond: (id = approvals.merge_request_id)
10. 53.055 88.425 ↑ 1.0 1 17,685

Index Scan using projects_pkey on projects (cost=0.43..4.06 rows=1 width=4) (actual time=0.004..0.005 rows=1 loops=17,685)

  • Index Cond: (id = merge_requests.target_project_id)
  • Filter: ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (visibility_level = ANY ('{0,10,20}'::integer[])))
11.          

SubPlan (for Index Scan)

12. 35.370 35.370 ↓ 0.0 0 17,685

Index Only Scan using index_project_authorizations_on_user_id_project_id_access_level on project_authorizations (cost=0.56..3.58 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=17,685)

  • Index Cond: ((user_id = 1) AND (project_id = projects.id))
  • Heap Fetches: 0
13. 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..49.16 rows=181 width=4) (never executed)

  • Index Cond: (user_id = 1)
  • Heap Fetches: 0
14. 35.370 35.370 ↑ 1.0 1 17,685

Index Scan using index_project_features_on_project_id on project_features (cost=0.43..0.48 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=17,685)

  • Index Cond: (projects.id = project_id)
Planning time : 3.048 ms
Execution time : 328.953 ms