Re: When does Postgres cache query plans?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: When does Postgres cache query plans?
Дата
Msg-id 15600.1346885470@sss.pgh.pa.us
обсуждение исходный текст
Ответ на When does Postgres cache query plans?  (Mike Christensen <mike@kitchenpc.com>)
Ответы Re: When does Postgres cache query plans?  (Mike Christensen <mike@kitchenpc.com>)
Список pgsql-general
Mike Christensen <mike@kitchenpc.com> writes:
> I'm curious under what circumstances Postgres will cache an execution
> plan for a query.

If you're writing raw SQL, never.  The assumption is that the
application knows its usage pattern a lot better than the server does,
and if the application is going to re-execute the same/similar statement
a lot of times, the app ought to make use of a prepared statement for
that.

Some client-side code (such as the JDBC driver) will make use of
prepared statements under the hood, so a lot depends on context.
But sending plain SQL with PQexec() does not result in any cached plan.

            regards, tom lane


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

Предыдущее
От: Edson Richter
Дата:
Сообщение: Re: Moving several databases into one database with several schemas
Следующее
От: Mike Christensen
Дата:
Сообщение: Re: When does Postgres cache query plans?