Prepare to fully shard the identities table

What does this MR do and why?

Follow up to !202814 (merged)

Addresses #578135

The table is sharded by identities#user_id. There is missing a foreign key constraint on the sharding key. I am running a background job that will remove all orphaned identities.

SQL

DELETE FROM "identities" WHERE ("identities"."id") IN (SELECT "identities"."id" FROM "identities" LEFT OUTER JOIN users ON identities.user_id = users.id WHERE "identities"."id" BETWEEN 33 AND 34 AND "identities"."id" >= 34 AND "users"."id" IS NULL)

Explain query: https://postgres.ai/console/gitlab/gitlab-production-main/sessions/44901/commands/137909

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Tomasz Skorupa

Merge request reports

Loading