Re: [GENERAL] New feature: accumulative functions.

2011-09-27 Thread pasman pasmański
Thanks Marti for inspiration :). Monotonic functions allows to skip some sorts in window expressions containing them: select winfun1(...) over(order by x), winfun2(...) over(order by f(x)) from ... 2011/9/27, pasman pasmański : > Yes, accumulative functions may be used for sorting,groupping an

Re: [GENERAL] New feature: accumulative functions.

2011-09-27 Thread pasman pasmański
Yes, accumulative functions may be used for sorting,groupping and merge joins with limit. Groupping looks simplest to implement, and comparable to performance of functional index . 2011/9/27, Marti Raudsepp : > 2011/9/25 pasman pasmański : >> My english is not perfect, by accumulative i think abo

Re: [GENERAL] New feature: accumulative functions.

2011-09-26 Thread Marti Raudsepp
2011/9/25 pasman pasmański : > My english is not perfect, by accumulative i think about monotonically > increasing function. > > It works that for clause WHERE f(x)=const: > 1. Read root page of index_on_x and get x1 ... Xn > 2. Calculate f(x1) ... f(xn) for this page > 3. When f(x1)<=const<= f(xn)

Re: [GENERAL] New feature: accumulative functions.

2011-09-26 Thread Harald Fuchs
In article , Pavel Stehule writes: > 2011/9/25 pasman pasmański : >> I found second use case. Look at expression: >> >> where left(str,n)='value' >> >> function left(str,n) increase monotonically for str and n. With this >> feature it can use index on str. >> >> Classic index needs recreating

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
I write small summary. Feature details: additional flags for monotonical functions. Learn planner to use them. New node in execution plan - functional index scan. Pro: single btree index may be used in many expressions containing only monotonnical functions. Contra: big developement effort. No n

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
For single argument strict increasing function f(x), estimation is simple: it is f(estimation of x). 2011/9/25, Pavel Stehule : > 2011/9/25 pasman pasmański : >> See that setting flag on function need less work than create new gist >> operator. Of course if postgresql's developers do biggest work

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Pavel Stehule
2011/9/25 pasman pasmański : > See that setting flag on function need less work than create new gist > operator. Of course if postgresql's developers do biggest work before. any feature in pg should to have a general usage - with real use cases and real performance advantages. I am not sure, if m

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
Yes, i wrote this for pleasure and discusion, not for solve a real problem :). 2011/9/25, Tom Lane : > =?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: >> I found second use case. Look at expression: >> where left(str,n)='value' > >> function left(str,n) increase monotonically for str and n. With this

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
See that setting flag on function need less work than create new gist operator. Of course if postgresql's developers do biggest work before. 2011/9/25, Pavel Stehule : > 2011/9/25 pasman pasmański : >> I found second use case. Look at expression: >> >> where left(str,n)='value' >> >> function lef

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Tom Lane
=?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: > I found second use case. Look at expression: > where left(str,n)='value' > function left(str,n) increase monotonically for str and n. With this > feature it can use index on str. Can't get excited about that, because that only works in C locale, and

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
This feature give profits for increasing muliti-arg functions. Example: WHERE f(x,param) = const it may be impossible to create functional indexes for all params. 2011/9/25, Pavel Stehule : > Hello > > what is a real use case? > > Regards > > Pavel > > 2011/9/25 pasman pasmański : >> My englis

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Pavel Stehule
2011/9/25 pasman pasmański : > I found second use case. Look at expression: > > where left(str,n)='value' > > function left(str,n) increase monotonically for str and n. With this > feature it can use index on str. > > Classic index needs recreating. > these use cases are just theory - for example

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
I found second use case. Look at expression: where left(str,n)='value' function left(str,n) increase monotonically for str and n. With this feature it can use index on str. Classic index needs recreating. 2011/9/25, Pavel Stehule : > Hello > > what is a real use case? > > Regards > > Pavel > >

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
... When n changes of course. Sorry for top posting, phone not allows to move cite. 2011/9/25, pasman pasmański : > I found second use case. Look at expression: > > where left(str,n)='value' > > function left(str,n) increase monotonically for str and n. With this > feature it can use index on str

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Pavel Stehule
2011/9/25 pasman pasmański : > This feature give profits for increasing muliti-arg functions. Example: > > WHERE f(x,param) = const > > it may be impossible to create functional indexes for all params. > Sorry, I asked on real use case. Do you know some one? Pavel > > > 2011/9/25, Pavel Stehule

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
I think, it should be new node in executor. Planner select classic index scan or new functional index scan. 2011/9/25, Tom Lane : > =?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: >> My english is not perfect, by accumulative i think about monotonically >> increasing function. > > Oh, I see how that

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Tom Lane
=?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: > My english is not perfect, by accumulative i think about monotonically > increasing function. Oh, I see how that would work. I can't get real excited about it though. The use-case seems a bit narrow, and the amount of complexity added to the btree s

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread pasman pasmański
My english is not perfect, by accumulative i think about monotonically increasing function. It works that for clause WHERE f(x)=const: 1. Read root page of index_on_x and get x1 ... Xn 2. Calculate f(x1) ... f(xn) for this page 3. When f(x1)<=const<= f(xn) then x1 <= searched x <= xn and we can te

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Radosław Smogura
pasman pasmański Sunday 25 of September 2011 15:19:28 > Hi. > > I propose to add "accumulative" flag to a function definition. This > flag would be set for function f(x) which is accumulative and > immutable. > > This flag allows to use an index on x for clauses containing f(x): > > where f(x)

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread Tom Lane
=?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: > I propose to add "accumulative" flag to a function definition. This > flag would be set for function f(x) which is accumulative and > immutable. Maybe you'd better define what you mean by "accumulative" ... > This flag allows to use an index on x fo

Re: [GENERAL] New feature: accumulative functions.

2011-09-25 Thread David Johnston
On Sep 25, 2011, at 9:19, pasman pasmański wrote: > Hi. > > I propose to add "accumulative" flag to a function definition. This > flag would be set for function f(x) which is accumulative and > immutable. > > This flag allows to use an index on x for clauses containing f(x): > > where f(x) =