Databases · Senior · Question 75 of 75
Why might a unique index on email be unsuitable once you add soft deletes?
- 1Unique indexes can't be created on text
- ✓Correct answer: A deleted user's row still holds the email, so a new sign-up with it fails; use a partial unique index
WHERE deleted_at IS NULL - 3Soft deletes remove unique indexes automatically
Explanation
Partial unique indexes enforce uniqueness only among active rows. Decide too whether email checks should be case-insensitive (lower(email)).