Remove index_ci_builds_on_token_encrypted from ci_builds
For partitioning ci_builds we had to include the partitioning key on all unique indexes, so all the queries supported by index_ci_builds_on_token_encrypted are also supported by unique_ci_builds_token_encrypted_and_partition_id, making index_ci_builds_on_token_encrypted redundant:
"index_ci_builds_on_token_encrypted" UNIQUE, btree (token_encrypted) WHERE token_encrypted IS NOT NULL
"unique_ci_builds_token_encrypted_and_partition_id" UNIQUE, btree (token_encrypted, partition_id) WHERE token_encrypted IS NOT NULL
Proposal
-
Disable
index_ci_builds_on_token_encryptedvia a change request. We want to do this step to lower the risks because we are working with a large table and recreating the index would be impossible during the week since it would take more than 12 hours.unique_ci_builds_token_encrypted_and_partition_idcan support all the queries that the old one does, so there will be no surprises here. - Write an async migration to drop the index on .com.
- Write a sync migration to drop the index everywhere else.
- Celebrate that
ci_buildssize was reduced by252 GB