Why can't a B-tree index seek for this filter?
CREATE INDEX idx_name ON users (name); SELECT * FROM users WHERE name LIKE '%son';
- Strings can't be indexed at all
SELECT *disables the index- The leading
%hides the prefix LIKEcan never use any kind of index
A B-tree is ordered by prefix, so a pattern starting with a wildcard has no starting point to seek to.
Play SQL & Databases ▸