Reopening a six months old discussion... Is there any plans to improve ts_rank performance by making it able to use GIN/GIST indices?
>From re-reading Oleg answers, I understand FTS indices do not contain enough information for ts_rank. Because of that, ts_rank has to read the ts_vector, which is stored in TOAST table, which triggers a random read for each ranked document. Cheers, Nicolas Grilly On Wed, Jul 13, 2011 at 18:55, Nicolas Grilly <nico...@gardentechno.com>wrote: > The first query ran in 347 seconds; the second one in 374 seconds. > Conclusion: There is no significant overhead in the ts_rank function > itself. It's slow because ts_rank has to read in random order 40 000 > ts_vector stored in TOAST table. The slow execution time looks like > a direct consequence of storing ts_vector in TOAST table... > > > :( The only solution I see is to store enough information for ranking > in index. > > Is it the expected behavior? How can I improve that? >