diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-01-23 12:03:15 +0100 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2018-01-23 22:33:42 +0100 |
commit | 090ca9c33e4c1939366e66c328af6dd61bf1db1d (patch) | |
tree | a62b2bf81e05a17abc30cd0614a950ece0be3f41 /db/schema.rb | |
parent | fbbd81eee6faf9ee9cb3f4071c35bc93147b94b3 (diff) | |
download | gitlab-ce-090ca9c33e4c1939366e66c328af6dd61bf1db1d.tar.gz |
Use limit for search count queriessearch-100
Search query is especially slow if a user searches a generic string
which matches many records, in such case search can take tens of
seconds or time out. To speed up the search query, we search only for
first 1000 records, if there is >1000 matching records we just display
"1000+" instead of precise total count supposing that with such amount
the exact count is not so important for the user.
Because for issues even limited search was not fast enough, 2-phase
approach is used for issues: first we use simpler/faster query to get
all public issues, if this exceeds the limit, we just return the limit.
If the amount of matching results is lower than limit, we re-run more
complex search query (which includes also confidential issues).
Re-running the complex query should be fast enough in such case because the
amount of matching issues is lower than limit.
Because exact total_count is now limited, this patch also switches to
to "prev/next" pagination.
Related #40540
Diffstat (limited to 'db/schema.rb')
-rw-r--r-- | db/schema.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/db/schema.rb b/db/schema.rb index a0901833c3d..4e82a688725 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180113220114) do +ActiveRecord::Schema.define(version: 20180115201419) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -886,6 +886,7 @@ ActiveRecord::Schema.define(version: 20180113220114) do add_index "issues", ["relative_position"], name: "index_issues_on_relative_position", using: :btree add_index "issues", ["state"], name: "index_issues_on_state", using: :btree add_index "issues", ["title"], name: "index_issues_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"} + add_index "issues", ["updated_at"], name: "index_issues_on_updated_at", using: :btree add_index "issues", ["updated_by_id"], name: "index_issues_on_updated_by_id", where: "(updated_by_id IS NOT NULL)", using: :btree create_table "keys", force: :cascade do |t| |