summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-30 09:58:31 -0700
committerStan Hu <stanhu@gmail.com>2018-07-30 10:03:05 -0700
commit00709a13a4197a8edd4cf9e6529c5d94f01ba012 (patch)
tree86d532f766bb979f18070d4a0ec11da19523ed38 /app/controllers/admin
parentcb2e07309b4e61501a44c3568155bdb73252338f (diff)
downloadgitlab-ce-00709a13a4197a8edd4cf9e6529c5d94f01ba012.tar.gz
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
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/jobs_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/admin/jobs_controller.rb b/app/controllers/admin/jobs_controller.rb
index ac1ae0f16b3..e355d5fdea7 100644
--- a/app/controllers/admin/jobs_controller.rb
+++ b/app/controllers/admin/jobs_controller.rb
@@ -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'