Re: [GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-04 Thread Gregory Stark
"Ivan Sergio Borgonovo" <[EMAIL PROTECTED]> writes: > Summarising it up: is it worth to add it here and there as an > optimisation flag? Probably not. Unless you're not planning on reading all the resulting records anyways and want the planner to optimize with that assumption. -- Gregory Star

Re: [GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-03 Thread Ivan Sergio Borgonovo
On Thu, 03 Apr 2008 10:33:56 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Gregory Stark <[EMAIL PROTECTED]> writes: > > You could fix that more cleanly with "ALTER FUNCTION myfunction > > ROWS 1" but only if that's always true, not just for > > myfunction(3,5). > > Perhaps the function shouldn't b

Re: [GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-03 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > You could fix that more cleanly with "ALTER FUNCTION myfunction ROWS 1" but > only if that's always true, not just for myfunction(3,5). Perhaps the function shouldn't be declared SETOF in the first place? regards, tom lane -- S

Re: [GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-03 Thread Gregory Stark
"Ivan Sergio Borgonovo" <[EMAIL PROTECTED]> writes: > I'm reviewing some function I wrote to add stable, immutable where > needed and I'd like to take the chance to add further "cheap" > optimisation if it helps. > > There are many places where I know a function or a statement will > return just o

[GENERAL] is it helpful for the optimiser/planner to add LIMIT 1

2008-04-03 Thread Ivan Sergio Borgonovo
I'm reviewing some function I wrote to add stable, immutable where needed and I'd like to take the chance to add further "cheap" optimisation if it helps. There are many places where I know a function or a statement will return just one row? Is it helpful to add LIMIT 1? eg. select a, b from myf