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
This commit is contained in:
Stan Hu 2018-07-30 09:58:31 -07:00
parent cb2e07309b
commit 00709a13a4
2 changed files with 6 additions and 1 deletions

View File

@ -2,7 +2,7 @@ class Admin::JobsController < Admin::ApplicationController
def index
@scope = params[:scope]
@all_builds = Ci::Build
@builds = @all_builds.order('created_at DESC')
@builds = @all_builds.order('id DESC')
@builds =
case @scope
when 'pending'

View File

@ -0,0 +1,5 @@
---
title: Fix /admin/jobs failing to load due to statement timeout
merge_request: 20909
author:
type: performance