Re: Poor performance using CTE

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Craig Ringer <craig(at)2ndQuadrant(dot)com>, Claudio Freire <klaussfreire(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, David Greco <David_Greco(at)harte-hanks(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Poor performance using CTE
Date: 2012-11-21 13:04:38
Message-ID: 50ACD166.1000507@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Peter Geoghegan 2012-11-21 13:15:40 Re: Poor performance using CTE
Previous Message Craig Ringer 2012-11-21 02:15:17 Re: Hints (was Poor performance using CTE)