A partial index indexes only rows that match a WHERE condition. It’s useful when most rows don’t need to be indexed (e.g., only active or not-deleted rows), making the index smaller and faster to scan and maintain.
CREATE INDEX idx_users_active_email
ON users (email)
WHERE active = true AND deleted_at IS NULL;