diff options
author | Stan Hu <stanhu@gmail.com> | 2019-09-09 17:05:55 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-09-09 21:51:57 -0700 |
commit | 08c3e59aeed34ad71e74afb674ddda7327fdc3a7 (patch) | |
tree | 544d9fa244519ac8b18b29ff8abf47bfdd40b30a /db/schema.rb | |
parent | ffa5328c39f195d3253e586569fc2474d3aa6860 (diff) | |
download | gitlab-ce-sh-fix-oauth-application-page.tar.gz |
Optimize /admin/applications so that it does not timeoutsh-fix-oauth-application-page
On our dev instance, /admin/applications as not loading because:
1. There was an unindexed query by `application_id`.
2. There was an expensive query that attempted to load 1 million
unique entries via ActiveRecord just to find the unique count.
We fix the first issue by adding an index for that column.
We fix the second issue with a simple SELECT COUNT(DISTINCT
resource_owner_id) SQL query.
In addition, we add pagination to avoid loading more than 20
applications at once.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/67228
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 6ddfb8bcb39..342e3a8d623 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_09_05_223900) do +ActiveRecord::Schema.define(version: 2019_09_10_000130) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" @@ -2390,6 +2390,7 @@ ActiveRecord::Schema.define(version: 2019_09_05_223900) do t.datetime "revoked_at" t.datetime "created_at", null: false t.string "scopes" + t.index ["application_id"], name: "index_oauth_access_tokens_on_application_id" t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true |