The best strategy isn't mentioned: learning how to read EXPLAIN output and acting on it.
> Using wildcards at the start and end of a LIKE will slow queries down
That's only true if you don't have the right indexes in place. A wildcard at the end can use a regular (btree) index. Even a LIKE query with wildcards in other places can be fast with a trigram index.
> Using wildcards at the start and end of a LIKE will slow queries down
That's only true if you don't have the right indexes in place. A wildcard at the end can use a regular (btree) index. Even a LIKE query with wildcards in other places can be fast with a trigram index.
https://niallburkley.com/blog/index-columns-for-like-in-post...