On Mon, Jun 24, 2013 at 11:55 AM, Emrah Mehmedov <emrah.mehmedov@x3mlabs.com> wrote: > Marcin: This heppens everytime when i try to query different keyword in FTS > for example: > > firsttime: query: "Hello & World" 15sec~ > secondtime: query: "Hello & World" 2-3sec > > then new query > > firsttime: query: "We & are & good" 10sec~ > secondtime: query: "We & are & good" 2-3sec >
Now it looks like Postgres is fetching data from disk on first query run, the second time it is from cache, so faster. Try:
AS rank FROM links, to_tsquery('english', 'risk') query WHERE query @@ vector ORDER BY rank DESC LIMIT 10;
with varying queries, and post the results. This will show how many blocks are are read from shared buffers, and how many are read from the OS(either from OS disk cache, or the actual disk).
Regards Marcin Mańk
Hi Marcin Mańk,
i run the query with analyze and explain and the time is pretty same as i calculate in php code, solution is to improve query or FTS dictionaries.