Index the normalized expression you actually query.
Section: Pattern catalog
PostgreSQL case-insensitive email lookup
sql
sql
CREATE INDEX idx_users_lower_email ON users ((lower(email)));
SELECT * FROM users WHERE lower(email) = lower('a@example.com');Explanation
If the predicate calls a function, a plain index on the raw column may not help enough.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Pattern catalog
MySQL generated column from JSON
Make a JSON path searchable with an index.
SQLite partial index for active rows
Shrink the index to the rows that matter most.