The query ignores the index. What fixes it?
CREATE INDEX idx_email ON users (email); SELECT * FROM users WHERE LOWER(email) = 'a@b.com';
- A hash index on
email - A
UNIQUEindex onemail - Run
ANALYZEonusers - An index on
LOWER(email)
Wrapping the column in a function hides it from a plain index; an expression index on
Play SQL & Databases ▸
LOWER(email) matches the predicate.