Skip to content

Commit 898e43b

Browse files
When LIMIT is used in SQL query then PG stops to use indexes. (#1079)
Workaround described here http://datamangling.com/2014/01/17/limit-1-and-performance-in-a-postgres-query/ Columns, which are used in WHERE and have indexes should be sorted.
1 parent cccfdd8 commit 898e43b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/travis/api/v3/queries/jobs.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module Travis::API::V3
22
class Queries::Jobs < Query
33
params :state, :created_by, :active, prefix: :job
4-
sortable_by :id
5-
default_sort "id:desc"
4+
sortable_by :id, :state
5+
default_sort "id:desc,state"
66

77
ACTIVE_STATES = %w(created queued received started).freeze
88

0 commit comments

Comments
 (0)