3 ms·
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 dow
by julian37 7y ago
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.
https://niallburkley.com/blog/index-columns-for-like-in-postgres/ https://niallburkley.com/blog/index-columns-for-like-in-post...
- janpot 7y ago> A wildcard at the end can use a regular (btree) index. depending on the locale your db is in, it might be a little less "regular". recently fell in that trap. http://blog.cleverelephant.ca/2016/08/pgsql-text-pattern-ops.html http://blog.cleverelephant.ca/2016/08/pgsql-text-pattern-ops...