On 12/12/2011 09:15 AM, David Johnston wrote:
Use a WITH clause on the SELECT statement.
Note that WITH is an optimisation fence, so if you're relying on Pg
pushing WHERE clauses down into subqueries or anything like that you may
find that your query runs a LOT slower when broken up as WITH expressions.
There's been talk of a Pg extension that allows optimisation through
WITH, but it's not currently possible.
Another option is to wrap things up in SQL functions or views.
--
Craig Ringer
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general