Joshua Rubin wrote:
Hi,
We have a very large, partitioned, table that we often need to query
from new connections, but frequently with similar queries. We have
constraint exclusion on to take advantage of the partitioning. This also
makes query planning more expensive. As a result, the CPU is fully
loaded, all the time, preparing queries, many of which have been
prepared, identically, by other connections.
Is there any way to have a persistent plan cache that remains between
connections? If such a mechanism existed, it would give us a great
speedup because the CPU's load for planning would be lightened
substantially.
It's not a great solution, but depending on the specific client
technology you use, it can done on the client-side. For example, I've
done it before in Java and PHP, and the principle extends to any
environment that has any possibility of maintaining "persistent"
connections to the database, if you create a thin wrapper for the
connections.
I have open-sourced such a wrapper for PHP, if you're interested.
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance