What is the most efficient way to perform a case insensitive search for a word in a
I've been using
WHERE LOWER(body) LIKE '%word%' but I think the calls to
LOWER() might be slowing the query significantly.
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
In PostgreSQL, you can use Text Search:
create index on foo_table using gin ( to_tsvector('simple', body) ); select * from foo_table where to_tsvector('simple', body) @@ plainto_tsquery('simple', 'word');