diff options
author | Sean McGivern <sean@gitlab.com> | 2018-11-23 13:06:04 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-11-23 13:06:04 +0000 |
commit | eb15e4dfc2953925cb4d029d007608a8d39bf97e (patch) | |
tree | d167107896b36501507d49357da795f068eb9f61 /app/models/issue.rb | |
parent | 3b601b82997a9bde956aff8e2628b012fcaa539e (diff) | |
download | gitlab-ce-speed-up-relative-positioning.tar.gz |
Speed up setting of relative positionspeed-up-relative-positioning
1. When every issue has a relative position set, we don't need to
perform any updates, or calculate the maximum position in the parent.
2. If we do need to calculate the maximum position in the parent, many
parents (specifically, groups with lots of projects) leads to a slow
query where only the index on issues.relative_position is used, not
the index on issues.project_id. Adding the GROUP BY forces Postgres
to use both indices.
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 0de5e434b02..780035c77e2 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -99,6 +99,10 @@ class Issue < ActiveRecord::Base alias_method :in_parents, :in_projects end + def self.parent_column + :project_id + end + def self.reference_prefix '#' end |