4 ms·
Postgres implements this[0] as well, and it's really wonderful. It doesn't give a human the search experience they are used to, but for the superhuman who can
by talolard 4y ago
Postgres implements this[0] as well, and it's really wonderful.
It doesn't give a human the search experience they are used to, but for the superhuman who can write regex , this becomes a very cheap way to search data at scale.
[0]https://www.postgresql.org/docs/current/pgtrgm.html https://www.postgresql.org/docs/current/pgtrgm.html
- eyelidlessness 4y ago> but for the superhuman who can write regex Usually when I write regex someone describes me as a monster. I guess both could be accurate!
- jkingsman 4y agoI use trigram indices on a project I run[0] where I want to do cheap filtering of DB results and the performance is just outstanding; I didn't think free text search could be so fast! CREATE EXTENSION IF NOT EXISTS pg_trgm; CREATE INDEX IF NOT EXISTS lowercase_title ON streams (lower(title)); CREATE INDEX IF NOT EXISTS title_trgm ON streams USING gin (lower(title) gin_trgm_ops); And boom, super performant search via `LIKE %{}%`. I also love taking advantage of `TABLESAMPLE system_rows()` which lets me do hyperfast random selection without needing to randomly sort the entire table. PG has so many hidden gems. [0] https://nobody.live https://nobody.live