Re: [GENERAL] Planner features, discussion

2010-07-15 Thread Craig Ringer
On 15/07/10 17:55, Alban Hertroys wrote: > On 15 Jul 2010, at 3:05, Craig Ringer wrote: > >> It was an example of how it'd be nice to avoid the need for a join when >> dealing with scalar values. I'd love to be able to write: >> >> WITH aconstant AS (1) >> SELECT x.*, aconstant FROM generate_serie

Re: [GENERAL] Planner features, discussion

2010-07-15 Thread Alban Hertroys
On 15 Jul 2010, at 3:05, Craig Ringer wrote: > It was an example of how it'd be nice to avoid the need for a join when > dealing with scalar values. I'd love to be able to write: > > WITH aconstant AS (1) > SELECT x.*, aconstant FROM generate_series(1,10) AS x; > > ... but can't presently do so

Re: [GENERAL] Planner features, discussion

2010-07-14 Thread Craig Ringer
On 15/07/10 00:34, David Fetter wrote: >> => WITH aconstant(constval) AS (VALUES(1)) SELECT x.*, constval FROM >> generate_series(1,10) AS x; >> ERROR: column "constval" does not exist >> LINE 1: ...TH aconstant(constval) AS (VALUES(1)) SELECT x.*, constval F... > > You missed the CROSS JOIN, wh

Re: [GENERAL] Planner features, discussion

2010-07-14 Thread David Fetter
On Wed, Jul 14, 2010 at 08:47:35AM +0800, Craig Ringer wrote: > On 13/07/2010 10:52 PM, Greg Smith wrote: > > >I heard a scholarly treatment of that topic from Jim Nasby recently, > >where he proposed a boolean GUC to toggle the expanded search behavior > >to be named plan_the_shit_out_of_it. > >

Re: [GENERAL] Planner features, discussion

2010-07-13 Thread Craig Ringer
On 13/07/2010 10:52 PM, Greg Smith wrote: I heard a scholarly treatment of that topic from Jim Nasby recently, where he proposed a boolean GUC to toggle the expanded search behavior to be named plan_the_shit_out_of_it. I was thinking that something like "duplicate subquery/function elimitatio

Re: [GENERAL] Planner features, discussion

2010-07-13 Thread Greg Smith
pasman pasman'ski wrote: 1. Planner will estimate 2 x statistics: time of query with cache empty and with cache filled. Requires planner to know something about the state of the cache; it doesn't yet. Counting myself there's four people I know who have been tinkering with some aspect of th

Re: [GENERAL] Planner features, discussion

2010-07-13 Thread Craig Ringer
On 13/07/10 19:49, pasman pasmański wrote: > Hello. > > I propose 2 features for planner: > > 1. Planner will estimate 2 x statistics: time of query with cache empty > and with cache filled. How would it know what is in cache and how long it'd take to fetch things into cache that aren't already

[GENERAL] Planner features, discussion

2010-07-13 Thread pasman pasmański
Hello. I propose 2 features for planner: 1. Planner will estimate 2 x statistics: time of query with cache empty and with cache filled. 2. Two levels of plannig: standard and long. Long planning may be used when standard optimization generate slow plan, and may use advanced algebraic transformat