Partial indexes are useful for enforcing rules that only apply conditionally
- ·
- Telegram
- ·
- Newsletter
⚡️ Database Tip
Sometimes you want to make columns unique but you can't because e.g. there are still soft-deleted rows in the table witht the same value. By only including relevant rows (partial index) you can still enforce uniqueness, and you can even simulate it for MySQL!