Partial, Expression, and Functional Indexes/PostgreSQL case-insensitive email lookup

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
Index only open items
Keep the hot subset small and efficient.
OpenIn sheetsqlsame section
MySQL generated column from JSON
Make a JSON path searchable with an index.
OpenIn sheetsqlsame section
SQLite partial index for active rows
Shrink the index to the rows that matter most.
OpenIn sheetsqlsame section