Interview practice question
LIKE queries are slow
Backend Engineering · Relational Databases · Intermediate
Users search products with WHERE name LIKE '%phone%', and it is slow on a large table. How would you improve it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Leading wildcard can't use B-tree index.
- Trigram index (pg_trgm) in Postgres.
- Full-text search (tsvector).
- Dedicated search engine for scale.
- Prefix search can use index.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.