Re: Slow cross-machine read on one table

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Slow cross-machine read on one table
Дата
Msg-id 499255A8.1020402@postnewspapers.com.au
обсуждение исходный текст
Ответ на Slow cross-machine read on one table  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Список pgsql-general
Rob Richardson wrote:
> The slow access seems to be happening with a single table.  Here's the
> query:

Can you post EXPLAIN ANALYZE output?

> This query took about 75 seconds.
>
> I ran PGAdmin on the same machine that the application is running on,
> and executed the same query on the same database.  It took about 30
> milliseconds.

In your application, are you using server-side prepared statements with
query parameters for some of the values in that query?

Try testing through PGAdmin / psql using PREPARE (with the same
parameter placeholders as your app uses) then EXECUTE, instead of a
straight SELECT.

If you get much slower execution that way, it'll be because the planner
doesn't know specific values for the parameter placeholders when
planning the query, so it can't make use of knowledge gained from table
statistics like "almost all values in the 'archived' column are zero'.

--
Craig Ringer

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Deleting conflicting rows when creating a foreign key
Следующее
От: Hiroshi Inoue
Дата:
Сообщение: Re: encoding of PostgreSQL messages