Hacker News new | ask | show | jobs
by olavgg 3325 days ago
actually it is easier

SELECT 1 FROM user_email WHERE email ILIKE 'Foo@Foo.coM';

1 comments

    WHERE lower(email) = lower('foo@example.com')
Is simple and hits an index on lower(email).

I'm not sure ILIKE can hit an index in your example.

It can if you use the pg_trgm extension, a good summary can be read here: https://niallburkley.com/blog/index-columns-for-like-in-post...