Commit graph

23 commits

Author SHA1 Message Date
Yorick Peterse
d6a8021ea1 Scope issue projects to a Group when possible
When using IssuableFinder with a Group we can greatly reduce the amount
of projects operated on (due to not including all public/internal
projects) by simply passing it down to the ProjectsFinder class.

This reduces the timings of the involved queries from roughly 300
ms to roughly 20 ms.

Fixes gitlab-org/gitlab-ce#4071, gitlab-org/gitlab-ce#3707
2016-01-18 12:27:33 +01:00
Yorick Peterse
fc443ea7bc Drop projects order in IssuableFinder
When grabbing the projects to filter issues by we don't care about the
order they're returned in. By removing the ORDER BY the resulting query
can be quite a bit faster.
2016-01-07 14:53:02 +01:00
Yorick Peterse
8591cc02be Use a JOIN in IssuableFinder#by_project
When using IssuableFinder/IssuesFinder to find issues for multiple
projects it's more efficient to use a JOIN + a "WHERE project_id IN"
condition opposed to running a sub-query.

This change means that when finding issues without labels we're now
using the following SQL:

    SELECT issues.*
    FROM issues
    JOIN projects ON projects.id = issues.project_id

    LEFT JOIN label_links ON label_links.target_type = 'Issue'
                          AND label_links.target_id  = issues.id

    WHERE (
        projects.id IN (...)
        OR projects.visibility_level IN (20, 10)
    )
    AND issues.state IN ('opened','reopened')
    AND label_links.id IS NULL
    ORDER BY issues.id DESC;

instead of:

    SELECT issues.*
    FROM issues
    LEFT JOIN label_links ON label_links.target_type = 'Issue'
                          AND label_links.target_id  = issues.id

    WHERE issues.project_id IN (
        SELECT id
        FROM projects
        WHERE id IN (...)
        OR visibility_level IN (20,10)
    )
    AND issues.state IN ('opened','reopened')
    AND label_links.id IS NULL
    ORDER BY issues.id DESC;

The big benefit here is that in the last case PostgreSQL can't properly
use all available indexes. In particular it ends up performing a
sequence scan on the "label_links" table (processing around 290 000
rows). The new query is roughly 2x as fast as the old query.
2015-11-19 11:58:05 +01:00
Yorick Peterse
e9cd58f5d5 Memoize IssuableFinder#projects
Since this method's returned data doesn't change between calls on the
same IssuableFinder instance we can just memoize this similar to the
"project" method.
2015-11-19 11:48:50 +01:00
Yorick Peterse
c232a0f97f Removed trailing whitespace from IssuableFinder 2015-11-19 11:48:50 +01:00
Douwe Maan
8b8fbd4e7f Rename confusing methods 2015-10-19 11:46:22 +02:00
Douwe Maan
0108cdf495 Improve performance of filtering issues by milestone 2015-10-16 11:43:26 +02:00
Zeger-Jan van de Weg
9127ae5ca8 Improve performance of queries
Credits to Douwe Maan
2015-10-16 11:30:26 +02:00
Zeger-Jan van de Weg
ac44e3844d Add project scope to milestone search 2015-10-16 11:30:26 +02:00
Stan Hu
dfbbc80611 Support filtering by "Any" milestone or issue and fix "No Milestone" and "No Label" filters
Closes #2619

Closes https://github.com/gitlabhq/gitlabhq/issues/9631
2015-10-07 07:21:50 -07:00
Guilherme Garnier
2b075f16c7 Fix rubocop warnings in app 2015-10-03 00:56:37 -05:00
Robert Speicher
d00cb00d6b Rename NoMilestone to Milestone::None
Also refactors IssuableFinder to avoid redundant title check.
2015-07-06 22:39:55 -04:00
Robert Speicher
3ee3cb24d4 Allow user to filter by Issues/Merge Requests without a Milestone 2015-07-06 22:39:55 -04:00
Dmitriy Zaporozhets
7524d7c082 Revert merge request states renaming
Replaced:
* "Accepted" with "Merged"
* "Rejected" with "Closed"

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-19 17:09:50 +02:00
Douwe Maan
45e4727f97 Set milestone on new issue when creating issue from index with milestone filter active. 2015-05-27 14:22:11 +02:00
Douwe Maan
d25026a512 Add Accepted and Rejected tabs to MR lists. 2015-05-25 17:01:27 +02:00
Dominik Sander
e6ee8d0ebe Group milestones by title in the dashboard and all other issue views
This groups milestones by title for issue views like it has been done for
the milestone dashboard/project overview. Before milestones with the
same title would show up multiple times in the filter dropdown and one could
only filter per project and milestone. Now the milestone filter is based
on the title of the milestone, i.e. all issues marked with the same
milestone title are shown.
2015-05-01 01:12:58 +02:00
Dmitriy Zaporozhets
c1c93f4f7a Fix tests and unassigned filter for issues. Updated CHANGELOG 2015-03-27 00:27:51 -07:00
Dmitriy Zaporozhets
dfb4fcb685 No magic numbers for issues filtering 2015-03-26 18:56:42 -07:00
Ciro Santilli
d37cf2a23d Factor permission check in issuable finder 2015-01-01 21:11:38 +01:00
Dmitriy Zaporozhets
e0f30c605b
Add author filter for issues & merge requests pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-12-05 17:13:07 +02:00
Marin Jankovski
d3bdd3ba67 Do not filter out issues and merge requests related to user right away. 2014-10-27 10:02:20 +01:00
Dmitriy Zaporozhets
20c2e90222
Refactor finders. Prevent circular dependency error
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-02 15:28:27 +03:00
Renamed from app/finders/base_finder.rb (Browse further)