• Stan Hu's avatar
    Use CTE optimization fence for loading projects in dashboard · ab126ec6
    Stan Hu authored
    Certain users experienced Error 500s when loading projects from the
    dashboard because the PostgreSQL query planner attempted to scan all
    projects rather than just the user's authorized projects. This would
    cause the query to hit a statement timeout.
    
    To fix this, we add support for a CTE optimization fence to load
    authorized projects first, which can be optionally used by
    `ProjectsFinder` via the `use_cte` parameter. To be safe, we only enable
    it for the finder call that loads the list of projects behind the
    `use_cte_for_projects_finder` feature flag.
    
    Closes https://gitlab.com/gitlab-org/gitlab/issues/198440
    ab126ec6
project.rb 77.4 KB