Add temporary partial index on services table
What does this MR do?
This change was requested as a part of review !24684 (comment 299612448)
In order to improve performance of upcoming data migration, we need to add partial index on services table
Oh and going one step further, if we have an index on
services (project_id, type, id)
- that should yield an index-only scan for the anti-join (since the filters and the id is all we need in the query fromservices
).
And yet another improvement (sorry): Let's make it partial for
services (project_id, id) WHERE type = 'PrometheusService'
since that is all we're interested in really. This is how it looks like with the partial index:
-> Index Only Scan using services_project_id_id_idx on services (cost=0.29..9.53 rows=87 width=8) (never executed)
Index Cond: ((project_id >= 1) AND (project_id <= 10000))
Heap Fetches: 0
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team