Slow query to find members by invite_email
From a current workload analysis in https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/6826, this query takes about 2,500ms and runs at 0.06 times per second. This puts it at TOP7 with respect to total database time in the observed 30-minute period on GitLab.com:
SELECT "members".\* FROM "members"
WHERE "members"."invite_email"
IN (?, ?) AND ("members"."invite_token"
IS NOT NULL)
A plan is here: https://explain.depesz.com/s/oFFy
We should add an index to speed up the query.
Edited by Andreas Brandl