Re: New feature: accumulative functions.

From: pasman pasmański <pasman(dot)p(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: New feature: accumulative functions.
Date: 2011-09-25 19:54:37
Message-ID: CAOWY8=aHGNF-KqPbVHD5R3F0ThM7RuK4fE_sUCFbR8qQ4t48Fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 <pavel(dot)stehule(at)gmail(dot)com>:
> Hello
>
> what is a real use case?
>
> Regards
>
> Pavel
>
> 2011/9/25 pasman pasmański <pasman(dot)p(at)gmail(dot)com>:
>> 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
>> test smaller range (xlower, xgreater).
>> 4. Otherwise no rows satisfy condition.
>>
>> Step 3 we repeat for current index's page and subpages until xlower =
>> searched x = xgreater
>>
>>
>> 2011/9/25, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> =?ISO-8859-2?Q?pasman_pasma=F1ski?= <pasman(dot)p(at)gmail(dot)com> 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 for clauses containing f(x):
>>>> where f(x) = const
>>>> where f(x) > const
>>>
>>> ... because it's sure not clear how you would get that to work.
>>>
>>>                       regards, tom lane
>>>
>>
>>
>> --
>> ------------
>> pasman
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>

--
------------
pasman

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pasman pasmański 2011-09-25 19:58:23 Re: New feature: accumulative functions.
Previous Message Pavel Stehule 2011-09-25 19:35:28 Re: New feature: accumulative functions.