Re: Poor performance using CTE - Mailing list pgsql-performance

From Heikki Linnakangas
Subject Re: Poor performance using CTE
Date
Msg-id 50ACD166.1000507@vmware.com
Whole thread Raw
In response to Re: Poor performance using CTE  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Poor performance using CTE  (Peter Geoghegan <peter@2ndquadrant.com>)
Re: Poor performance using CTE  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-performance
On 21.11.2012 01:53, Tom Lane wrote:
> I think the more interesting question is what cases wouldn't be covered
> by such a rule.  Typically you need to use OFFSET 0 in situations where
> the planner has guessed wrong about costs or rowcounts, and I think
> people are likely using WITH for that as well.  Should we be telling
> people that they ought to insert OFFSET 0 in WITH queries if they want
> to be sure there's an optimization fence?

Yes, I strongly feel that we should. Writing a query using WITH often
makes it more readable. It would be a shame if people have to refrain
from using it, because the planner treats it as an optimization fence.

- Heikki


pgsql-performance by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Hints (was Poor performance using CTE)
Next
From: Peter Geoghegan
Date:
Subject: Re: Poor performance using CTE