summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2015-10-07 17:37:39 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2015-10-08 14:35:32 +0200
commit03417456f0b7db408bfefd28e5b9342889b7f711 (patch)
tree77da54c8c65a594672f0d5e3416caff05619a275 /app/models/concerns
parent1190d0ab3dc7a3025bf55b666f34d1a0b51a8d89 (diff)
downloadgitlab-ce-03417456f0b7db408bfefd28e5b9342889b7f711.tar.gz
Revamp finding projects by namespaces
By using a JOIN we can remove the need for using 2 separate queries to find a project by its namespace. Combined with an index (only needed for PostgreSQL) this reduces the query time from ~245 ms (~520 ms for the first call) down to roughly 10 ms (~15 ms for the first call).
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/case_sensitivity.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/concerns/case_sensitivity.rb b/app/models/concerns/case_sensitivity.rb
index 49d350e092b..fe0cea8465f 100644
--- a/app/models/concerns/case_sensitivity.rb
+++ b/app/models/concerns/case_sensitivity.rb
@@ -6,7 +6,7 @@ module CaseSensitivity
# Queries the given columns regardless of the casing used.
#
# Unlike other ActiveRecord methods this method only operates on a Hash.
- def case_insensitive_where(params)
+ def iwhere(params)
criteria = self
cast_lower = Gitlab::Database.postgresql?