Search Postgresql Archives

Re: When does Postgres cache query plans?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike Christensen <mike@xxxxxxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux