I have an existing table which has a GUID/UUID column which should have a unique constraint applied to it when the column was created. This table has a few hundred thousand rows in it right now in production.
I’ve made sure that my production data doesn’t have any duplicates for this column, however, there’s some application code which will be deployed soon which could insert duplicates into the table.To prevent this possibility, I want to apply a unique constraint. The application code handles the exception with specific business logic.
For my pre-production environments, I have created a cleanup script which will take care of the duplicates before applying the constraint.
What are performance considerations I would need to watch out for before adding the constraint in question?