Re: Controlling complexity in queries - Mailing list pgsql-general

From Craig Ringer
Subject Re: Controlling complexity in queries
Date
Msg-id 4EE5709D.4020108@ringerc.id.au
Whole thread Raw
In response to Re: Controlling complexity in queries  (David Johnston <polobo@yahoo.com>)
Responses Re: Controlling complexity in queries
List pgsql-general
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

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Howto to clear PostgreSQL cache and how to preload all tuples of a table into the cache?
Next
From: devrim@gunduz.org
Date:
Subject: Re: Problem installing PG9.1 using yum