Re:Postgres Full-Text Search: A search engine in a database
by ezekg on Tuesday July 27, 2021 @02:52PM
(#27976085)
I'm not a DBA, so I can't say for certain simply due to a gap in my knowledge. But in my experience, it depends on a lot of factors. Sometimes pg will use an index before performing the search ops, other times a subquery is needed. Check out pgmustard and dig into your slow query plans. :)
Re:Postgres Full-Text Search: A search engine in a database
by john-shaffer on Tuesday July 27, 2021 @06:24PM
(#27978407)
You might be just fine adding an unindexed tsvector column, since you've already filtered down the results.
The GIN indexes for FTS don't really work in conjunction with other indices, which is why https://github.com/postgrespro/rum exists. Luckily, it sounds like you can use your existing indices to filter and let postgres scan for matches on the tsvector. The GIN tsvector indices are quite expensive to build, so don't add one if postgres can't make use of it!
Re:Postgres Full-Text Search: A search engine in a database
by ezekg on Wednesday July 28, 2021 @03:50PM
(#27988876)
Great read on the pitfalls of GIN indexes: https://iamsafts.com/posts/postgres-gin-performance/ (I'm not the author, but this did happen to me.)
Find me some results in my area that contain these categoryIds and are slotted to start between now and next 10 days.
Since its already quite a filtered set of data, would that mean I should have little issues adding pg text search because with correct indexing and all, it will usually be applied to a small set of data?
Thanks