Skip to content

Add performance optimization for Insights queries

What does this MR do and why?

Improves performance of specific Insights queries.

Database migration

main: == 20220822094804 AddIssuesAuthorizationIndex: reverting ======================
main: -- index_name(:issues, "idx_open_issues_on_project_and_confidential_and_author_and_id")
main:    -> 0.0000s
main: == 20220822094804 AddIssuesAuthorizationIndex: reverted (0.0136s) =============

main: == 20220822094804 AddIssuesAuthorizationIndex: migrating ======================
main: -- index_exists?(:issues, [:project_id, :confidential, :author_id, :id], {:name=>"idx_open_issues_on_project_and_confidential_and_author_and_id", :where=>"state_id = 1", :algorithm=>:concurrently})
main:    -> 0.0168s
main: == 20220822094804 AddIssuesAuthorizationIndex: migrated (0.0185s) =============

Migration is expected to be finished in 40 minutes.

Query plans:

Main goal was to hit indexes only when performing query. Timing might be not accurate since index creation loads many records into memory before executing a query.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #338802 (closed)

Edited by Pavel Shutsin

Merge request reports