explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Ffif

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 627.264 ↑ 1.0 20 1

Limit (cost=14,886.99..14,887.04 rows=20 width=20) (actual time=627.253..627.264 rows=20 loops=1)

2. 26.498 627.255 ↑ 72.5 20 1

Sort (cost=14,886.99..14,890.61 rows=1,450 width=20) (actual time=627.252..627.255 rows=20 loops=1)

  • Sort Key: merge_request_metrics.latest_build_finished_at DESC
  • Sort Method: top-N heapsort Memory: 26kB
3. 64.583 600.757 ↓ 135.5 196,430 1

Nested Loop (cost=1,242.14..14,848.41 rows=1,450 width=20) (actual time=0.116..600.757 rows=196,430 loops=1)

4. 1.269 44.774 ↓ 31.5 2,457 1

Nested Loop (cost=1,241.56..12,786.31 rows=78 width=20) (actual time=0.088..44.774 rows=2,457 loops=1)

5. 0.453 19.897 ↓ 11.4 2,951 1

Nested Loop (cost=1,241.00..12,382.37 rows=258 width=4) (actual time=0.071..19.897 rows=2,951 loops=1)

6. 0.102 4.471 ↑ 3.0 713 1

Nested Loop (cost=1,240.43..4,713.16 rows=2,172 width=4) (actual time=0.055..4.471 rows=713 loops=1)

7. 1.701 1.701 ↑ 1.4 92 1

CTE Scan on base_and_descendants namespaces (cost=1,240.00..1,242.62 rows=131 width=2,908) (actual time=0.037..1.701 rows=92 loops=1)

8.          

CTE base_and_descendants

9. 0.451 1.426 ↑ 1.4 92 1

Recursive Union (cost=0.43..1,240.00 rows=131 width=323) (actual time=0.034..1.426 rows=92 loops=1)

10. 0.055 0.055 ↑ 1.0 1 1

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

  • Index Cond: (id = 9,970)
  • Filter: ((type)::text = 'Group'::text)
11. 0.124 0.920 ↓ 1.4 18 5

Nested Loop (cost=0.43..123.39 rows=13 width=323) (actual time=0.053..0.184 rows=18 loops=5)

12. 0.060 0.060 ↓ 1.8 18 5

WorkTable Scan on base_and_descendants (cost=0.00..0.20 rows=10 width=4) (actual time=0.010..0.012 rows=18 loops=5)

13. 0.736 0.736 ↑ 1.0 1 92

Index Scan using index_namespaces_on_parent_id_and_id on namespaces namespaces_2 (cost=0.43..12.31 rows=1 width=323) (actual time=0.005..0.008 rows=1 loops=92)

  • Index Cond: (parent_id = base_and_descendants.id)
  • Filter: ((type)::text = 'Group'::text)
14. 2.668 2.668 ↑ 2.1 8 92

Index Scan using index_projects_on_namespace_id on projects (cost=0.43..26.31 rows=17 width=8) (actual time=0.009..0.029 rows=8 loops=92)

  • Index Cond: (namespace_id = namespaces.id)
15. 14.973 14.973 ↑ 2.0 4 713

Index Scan using index_merge_requests_target_project_id_created_at on merge_requests (cost=0.56..3.45 rows=8 width=8) (actual time=0.008..0.021 rows=4 loops=713)

  • Index Cond: ((target_project_id = projects.id) AND (created_at >= '2019-12-29 00:00:00+00'::timestamp with time zone) AND (created_at <= '2020-01-28 00:00:00+00'::timestamp with time zone))
16. 23.608 23.608 ↑ 1.0 1 2,951

Index Scan using index_merge_request_metrics on merge_request_metrics (cost=0.56..1.56 rows=1 width=24) (actual time=0.008..0.008 rows=1 loops=2,951)

  • Index Cond: (merge_request_id = merge_requests.id)
  • Filter: (latest_build_finished_at >= latest_build_started_at)
  • Rows Removed by Filter: 0
17. 491.400 491.400 ↑ 1.2 80 2,457

Index Scan using index_ci_builds_on_commit_id_and_stage_idx_and_created_at on ci_builds (cost=0.57..25.35 rows=95 width=8) (actual time=0.011..0.200 rows=80 loops=2,457)

  • Index Cond: (commit_id = merge_request_metrics.pipeline_id)
Planning time : 7.110 ms
Execution time : 627.580 ms