UpdateHighestRoleWorker generates very expensive SQL queries
The UpdateHighestRoleWorker
worker generates some very expensive SQL queries.
The query below is taking up to 10s to complete. This query also takes place on the primary Postgres instance.
SELECT MAX("members"."access_level") FROM "members" WHERE "members"."user_id" = $1 AND "members"."requested_at" IS NULL
Kibana search: https://log.gprd.gitlab.net/goto/63410f37c6d6cedfa509a3720936f260
cc @lmcandrew