Create index for users.unconfirmed_email
What does this MR do?
Create index for users.unconfirmed_email
This speeds up the following query:
SELECT
users.*
FROM
users
WHERE
users.unconfirmed_email = ?
ORDER BY
users.id ASC
LIMIT 1
Context is https://gitlab.com/gitlab-org/gitlab-ce/issues/66958.
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios.
Performance and Testing
- Plan without index (~10,800ms): https://explain.depesz.com/s/0VBw
- Plan with index (<1 ms): https://explain.depesz.com/s/7kQ9
More testing in https://gitlab.com/gitlab-org/gitlab-ce/snippets/1892156
Edited by Andreas Brandl