Commit Graph

37 Commits

Author SHA1 Message Date
GitLab Bot 7aa165d479 Add latest changes from gitlab-org/gitlab@master 2024-05-02 06:12:09 +00:00
GitLab Bot 63414b32fd Add latest changes from gitlab-org/gitlab@master 2022-12-05 15:08:04 +00:00
GitLab Bot f26a600a69 Add latest changes from gitlab-org/gitlab@master 2022-09-08 21:13:09 +00:00
GitLab Bot 6b8af95df6 Add latest changes from gitlab-org/gitlab@master 2021-07-07 09:08:35 +00:00
GitLab Bot dfda8b7e77 Add latest changes from gitlab-org/gitlab@master 2021-03-18 15:09:04 +00:00
GitLab Bot 211a8c3361 Add latest changes from gitlab-org/gitlab@master 2020-02-07 12:09:13 +00:00
Alexandru Croitor f5b855546e Update sort options for issues list
Increase sort options for issues list from updated_at and create_at,
to include more options close to what is required in actual issue list
UI.

This helps us to use REST API for issues list with sorting capabilities

https://gitlab.com/gitlab-org/gitlab-ce/issues/57402
2019-08-23 11:32:15 +03:00
Sean McGivern 10ceb33ba2 Extend CTE search optimisation to projects
When we use the `search` param on an `IssuableFinder`, we can run into
issues. We have trigram indexes to support these searches. On
GitLab.com, we often see Postgres's optimiser prioritise the (global)
trigram indexes over the index on `project_id`. For group and project
searches, we know that it will be quicker to filter by `project_id`
first, as it returns fewer rows in most cases.

For group issues search, we ran into this issue previously, and went
through the following iterations:

1. Use a CTE on the project IDs as an optimisation fence. This prevents
   the planner from disregarding the index on `project_id`.
   Unfortunately it breaks some types of sorting, like priority and
   popularity, as they sort on a joined table.
2. Use a subquery for listing issues, and a CTE for counts. The subquery
   - in the case of group lists - didn't help as much as the CTE, but
   was faster than not including it. We can safely use a CTE for counts
   as they don't have sorting.

Now, however, we're seeing the same issue in a project context. The
subquery doesn't help at all there (it would only return one row, after
all). In an attempt to keep total code complexity under control, this
commit removes the subquery optimisation and applies the CTE
optimisation only for sorts we know that are safe.

This means that for more complicated sorts (like priority and
popularity), the search will continue to be very slow. If this is a
high-priority issue, we can consider introducing further optimisations,
but this finder is already very complicated and additional complexity
has a cost.

The group CTE optimisation is controlled by the same feature flag as
before, `attempt_group_search_optimizations`, which is enabled by
default. The new project CTE optimisation is controlled by a new feature
flag, `attempt_project_search_optimizations`, which is disabled by
default.
2019-04-04 12:36:22 +01:00
Jacopo c6bddeacf4 Updates code using class_methods over module ClassMethods 2018-08-29 16:56:34 +02:00
Stan Hu 27f5efcfa5 Merge branch 'frozen-string-enable-app-models-even-more' into 'master'
Enable more frozen string in app/models/**/*.rb

See merge request gitlab-org/gitlab-ce!21019
2018-08-08 12:40:19 +00:00
Oswaldo Ferreira ef66a4a57c Fix missing and duplicates on project milestone listing page 2018-08-07 13:02:55 -03:00
gfyoung 15b878e27e Enable more frozen string in app/models/**/*.rb
Partially addresses #47424.
2018-08-07 00:37:36 -07:00
Douglas Barbosa Alexandre e8edf620f1
Fix sorting by name on explore projects page 2018-06-25 18:31:30 -03:00
Harish Ved b11c218ad9 Fix: Use case in-sensitive ordering by name for groups 2018-05-17 16:20:41 +00:00
Vitaliy @blackst0ne Klachkov 0d236638b6 Improve list of sorting options 2017-09-23 11:46:53 +11:00
Tiago Botelho cfd475a45e Removes default scope from sortable 2017-09-07 13:01:59 +01:00
Sean McGivern 8170384d80 Revert "Merge branch 'revert-2c879643' into 'master'"
This reverts merge request !12633
2017-07-14 11:38:06 +00:00
Douwe Maan 2c78c7f4cd Revert "Merge branch 'revert-12499' into 'master'"
This reverts merge request !12557
2017-07-04 17:08:41 +00:00
Adam Niedzielski a3d7983b18 Revert "Merge branch 'dm-drop-default-scope-on-sortable-finders' into 'master'"
This reverts commit b07c00032b, reversing
changes made to 2b97d76d0b.
2017-06-29 16:14:12 +02:00
Douwe Maan 4d6ee98d86 Drop default ORDER scope when calling a find method on a Sortable model 2017-06-28 14:23:36 -05:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Douwe Maan 1fe7501b49 Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
2017-02-23 09:33:05 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Douwe Maan 5c7f9d69e3 Fix code for cops 2017-02-23 09:31:57 -06:00
Douwe Maan 8a4d68c53e Enable Style/ConditionalAssignment 2017-02-23 09:31:57 -06:00
Alejandro Rodríguez 7bd6ff03d8 Fix and improve `Sortable.highest_label_priority` 2016-10-27 21:26:56 -03:00
Douglas Barbosa Alexandre 928acba4c0 Use keyword arguments on Sortable#highest_label_priority 2016-10-19 14:58:27 -02:00
Douglas Barbosa Alexandre 3c2aaec1f2 Fix sorting by label priorities 2016-10-19 14:58:27 -02:00
Felipe Artur 37bf35f0bc Todos sorting dropdown 2016-08-19 16:14:20 -03:00
Yorick Peterse 9dacc3bc56 Sort by ID when sorting using "Recently created"
Sorting by "id" has the same effect as sorting by created_at while
performing far better and without the need of an extra index (in case
one wanted to speed up sorting by "created_at").

Sorting by "Recently updated" still uses the physical "updated_at"
column as there's no way to use the "id" column for this instead.
2016-01-07 14:53:02 +01:00
Yorick Peterse 656d9ff69b Make it easier to re-apply default sort orders
By moving the default sort order into a separate scope (and calling this
from the default scope) we can more easily re-apply a default order
without having to specify the exact column/ordering all over the place.
2015-11-18 13:05:45 +01:00
Yorick Peterse 732f5380af Only sort by IDs by default
Sorting by both "created_at" and "id" in descending order is not needed
as simply sorting by "id" in descending order will already sort rows
from new to old. Depending on the query and data involved sorting twice
can also introduce significant overhead.
2015-11-03 11:54:43 +01:00
Dmitriy Zaporozhets 4cce10583d Fix tests for semaphore 2015-02-06 23:57:28 -08:00
Dmitriy Zaporozhets c5be267e40 Refactor issuable sorting a bit 2015-02-05 20:21:21 -08:00
Dmitriy Zaporozhets bbca6a0abd Refactor sorting in project 2015-02-05 19:15:05 -08:00
Dmitriy Zaporozhets e0aa5c371e Fix method overlap for issue sorting 2015-02-05 16:49:41 -08:00
Dmitriy Zaporozhets 62ed1c537e Explicitly define ordering in models using default_scope 2015-02-05 14:20:55 -08:00