1) All of the stemming/indexing is done on creation/update of the object instead of per query
2) Because of #1, the size of the query is much smaller.
3) The tsvector column can be indexed
Because I am by no means an expert on postgres or postgres search, before I switch from pg_search to using one tsvector column, i wanted to check in with the members of this mailing list. What are the advantages to using pg_search dynamic queries vs populating a tsvector column on creation of the entity?
thx!
-karl
Briefly, using a tsvector column will greatly increase the speed of
your searches should you have many rows to search across. The reason
the support was added to pg_search was that searching across 1.6
million records with an expression-based index took around 18-22
seconds depending on the number of rows the query matched. Using
tsvector columns this went down to 400-1000ms, again depending on the
number of matching rows. Also with this dataset we chose to use GIN
indexes instead of GIST; I'd suggest looking into the PostgreSQL
documentation to find out which will work best for you.
That goes for all large fields actually not just tsvector.