Commit 00709a13 authored by Stan Hu's avatar Stan Hu

Fix /admin/jobs failing to load due to statement timeout

The `ORDER BY created_at DESC` clause causes a sequential scan because
there is no index on the `created_at` column. We can sort by `id`
or by `updated_at` to make things fast.

Closes #49767
parent cb2e0730
...@@ -2,7 +2,7 @@ class Admin::JobsController < Admin::ApplicationController ...@@ -2,7 +2,7 @@ class Admin::JobsController < Admin::ApplicationController
def index def index
@scope = params[:scope] @scope = params[:scope]
@all_builds = Ci::Build @all_builds = Ci::Build
@builds = @all_builds.order('created_at DESC') @builds = @all_builds.order('id DESC')
@builds = @builds =
case @scope case @scope
when 'pending' when 'pending'
......
---
title: Fix /admin/jobs failing to load due to statement timeout
merge_request: 20909
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment