Re: PHP Postgres query slower then PgAdmin

Поиск
Список
Период
Сортировка
От Emrah Mehmedov
Тема Re: PHP Postgres query slower then PgAdmin
Дата
Msg-id CAGRV00L75SnLUfWG5xLkKEazd6rMriJRzRu2=NzNhBehx8EBoA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PHP Postgres query slower then PgAdmin  (Marcin Mańk <marcin.mank@gmail.com>)
Список pgsql-performance
On Mon, Jun 24, 2013 at 12:04 PM, Marcin Mańk <marcin.mank@gmail.com> wrote:
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:

EXPLAIN(ANALYZE, BUFFERS) SELECT title, url, ts_rank_cd(vector, query)
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.

Thank you.
--
Best regards, Emrah Mehmedov
Software Developer @ X3M Labs
http://www.extreme-labs.com

В списке pgsql-performance по дате отправления:

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: on disk and in memory
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: incorrect row estimates for primary key join