Specific CI indexes to avoid statement timeout.
What does this MR do?
This adds two indexes that have been added to GitLab.com as part of the discussion in https://gitlab.com/gitlab-org/gitlab-ce/issues/50763#note_100137576 but have not made it into a release yet. The idea is to add them here and once released, remove the manually created ones from GitLab.com with gitlab-com/gl-infra/production#524 (closed).
The performance observation in https://gitlab.com/gitlab-org/gitlab-ce/issues/50763#note_97135263 is still true for GitLab.com (ie, those indexes are needed to improve the query runtime). We may consider improving the query by rewriting, but here it is solely about schema cleanup (bigger context: https://gitlab.com/gitlab-org/gitlab-ce/issues/51438).
The change to the #indexes
method in ...::PostgreSQL::SchemaStatements
was necessary because there was an ambiguity when parsing the CREATE INDEX
syntax: The column syntax is ( { column_name | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] )
, so we should not treat ASC
or DESC
as opclasses but rather as order expressions. The combined case of column opclass ASC
is still not supported though, but we also don't have it anywhere.
What are the relevant issue numbers?
https://gitlab.com/gitlab-org/gitlab-ce/issues/50763 gitlab-com/gl-infra/production#524 (closed)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Conforms to the database guides