Harden users_created usage data queries
What does this MR do?
Harden users_created usage data queries
Query MIN
SELECT MIN("users"."id") FROM "users" WHERE "users"."created_at" BETWEEN '2020-05-08 12:07:41.738136' AND '2020-06-05 12:07:41.738208';
https://explain.depesz.com/s/W4os 18 seconds
Before:After: Precomputed value
Query MAX
SELECT MAX("users"."id") FROM "users" WHERE "users"."created_at" BETWEEN '2020-05-08 12:07:41.738136' AND '2020-06-05 12:07:41.738208';
https://explain.depesz.com/s/9ELwk <10 ms
Before:After: Precomputed value
Query COUNT
SELECT COUNT("users"."id") FROM "users" WHERE "users"."created_at" BETWEEN '2020-05-08 12:14:46.058262' AND '2020-06-05 12:14:46.058335' AND "users"."id" BETWEEN 1 AND 10000;
https://explain.depesz.com/s/7Hnl < 250 ms
Before:After:
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
Closes #220478 (closed)
Edited by Jan Provaznik