Re: Persistent Plan Cache - Mailing list pgsql-performance

From Ivan Voras
Subject Re: Persistent Plan Cache
Date
Msg-id h8l5vi$ul6$2@ger.gmane.org
Whole thread Raw
In response to Persistent Plan Cache  (Joshua Rubin <jrubin@esoft.com>)
List pgsql-performance
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.

pgsql-performance by date:

Previous
From: tv@fuzzy.cz
Date:
Subject: Re: possible wrong query plan on pg 8.3.5,
Next
From: zz_11@mail.bg
Date:
Subject: Re: possible wrong query plan on pg 8.3.5,