Geo - Improve query to retrieve Job Artifacts, LFS Objects, and Uploads with files stored locally
What does this MR do?
A default value for these columns has been set in !30769 (merged). And in !31261 (merged), we updated the invalid records and added a not-null constraint on these columns. Now, is no longer need to check for records with NULL
in these columns.
Database queries
Before
EXPLAIN SELECT "lfs_objects"."id"
FROM "lfs_objects"
WHERE (
"lfs_objects"."file_store" = 1
OR "lfs_objects"."file_store" IS NULL)
AND "lfs_objects"."id" BETWEEN 1 AND 1000;
Time: 3.968 s
- planning: 0.219 ms
- execution: 3.968 s
- I/O read: 3.870 s
- I/O write: 0.000 ms
Shared buffers:
- hits: 1 (~8.00 KiB) from the buffer pool
- reads: 5601 (~43.80 MiB) from the OS file cache, including disk I/O
- dirtied: 4682 (~36.60 MiB)
- writes: 0
Plan: https://explain.depesz.com/s/xlat
After
EXPLAIN SELECT "lfs_objects"."id"
FROM "lfs_objects"
WHERE "lfs_objects"."file_store" = 1
AND "lfs_objects"."id" BETWEEN 1 AND 1000;
Time: 0.239 ms
- planning: 0.192 ms
- execution: 0.047 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 4 (~32.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
Plan: https://explain.depesz.com/s/ui1j
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
Related issues
Edited by Michael Kozono