Re: [GENERAL] subselects vs WITH in views

2013-02-21 Thread Merlin Moncure
On Thu, Feb 21, 2013 at 4:31 AM, Seref Arikan wrote: > Hi Merlin, > So should I interpret this as: there is a potential gain from choosing > subqueries over with WITHs ? Well, potentially, yes. WITH is a mechanic to force iterative order of evaluation on queries. This can be a good or bad thing

Re: [GENERAL] subselects vs WITH in views

2013-02-21 Thread Seref Arikan
Hi Merlin, So should I interpret this as: there is a potential gain from choosing subqueries over with WITHs ? On Tue, Feb 19, 2013 at 3:33 PM, Merlin Moncure wrote: > On Tue, Feb 19, 2013 at 9:22 AM, Joe Van Dyk wrote: > > On Tue, Feb 19, 2013 at 1:02 AM, Albe Laurenz > > wrote: > >> > >> J

Re: [GENERAL] subselects vs WITH in views

2013-02-19 Thread Merlin Moncure
On Tue, Feb 19, 2013 at 9:22 AM, Joe Van Dyk wrote: > On Tue, Feb 19, 2013 at 1:02 AM, Albe Laurenz > wrote: >> >> Joe Van Dyk wrote: >> > My assumption was that WITH acted just like subselects, but apparently >> > they don't? Using WITH doesn't >> > use the expected index. >> >> Currently WITH a

Re: [GENERAL] subselects vs WITH in views

2013-02-19 Thread Joe Van Dyk
On Tue, Feb 19, 2013 at 1:02 AM, Albe Laurenz wrote: > Joe Van Dyk wrote: > > My assumption was that WITH acted just like subselects, but apparently > they don't? Using WITH doesn't > > use the expected index. > > Currently WITH acts as an "optimization fence", that means > that means that the pla

Re: [GENERAL] subselects vs WITH in views

2013-02-19 Thread Albe Laurenz
Joe Van Dyk wrote: > My assumption was that WITH acted just like subselects, but apparently they > don't? Using WITH doesn't > use the expected index. Currently WITH acts as an "optimization fence", that means that means that the planner won't move conditions into or out of the WITH query. Yours

[GENERAL] subselects vs WITH in views

2013-02-18 Thread Joe Van Dyk
My assumption was that WITH acted just like subselects, but apparently they don't? Using WITH doesn't use the expected index. (the below also at: https://gist.github.com/joevandyk/839413fac7b3bdd32cb3/raw/cec015d16bed7f4e20ab0101b58ae74a1df1cdc2/gistfile1.txt create view promotion_details1 as (