Re: New feature: accumulative functions.

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: New feature: accumulative functions.
Дата
Msg-id CAFj8pRCu86pXm3dM0tybq4tss37Yxj=cVhN=YDag0PTKPcZVeg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: New feature: accumulative functions.  (pasman pasmański <pasman.p@gmail.com>)
Ответы Re: New feature: accumulative functions.
Список pgsql-general
2011/9/25 pasman pasmański <pasman.p@gmail.com>:
> 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 monotonically functions should be useful - this
request is relative strong. This feature should be interesting, but
should be a source of bugs if somebody use it wrong. Some similar
searching is possible with multidimensional indexes.

note: a searching is one task - second task is design of estimations.

Pavel

>
>
> 2011/9/25, Pavel Stehule <pavel.stehule@gmail.com>:
>> 2011/9/25 pasman pasmański <pasman.p@gmail.com>:
>>> 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 - this case should be
>> solved with immutable functions
>>
>> I can use a functional index left(str, const) and use a query
>>
>> where left(str, const) = left('value', const) and left(str, n) = 'value'
>>
>> There are a theoretical cases, but these cases should be solved via
>> special data type and GiST index
>>
>> Pavel
>>
>>> 2011/9/25, Pavel Stehule <pavel.stehule@gmail.com>:
>>>> Hello
>>>>
>>>> what is a real use case?
>>>>
>>>> Regards
>>>>
>>>> Pavel
>>>>
>>>> 2011/9/25 pasman pasmański <pasman.p@gmail.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@sss.pgh.pa.us>:
>>>>>> =?ISO-8859-2?Q?pasman_pasma=F1ski?= <pasman.p@gmail.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@postgresql.org)
>>>>> To make changes to your subscription:
>>>>> http://www.postgresql.org/mailpref/pgsql-general
>>>>>
>>>>
>>>
>>>
>>> --
>>> ------------
>>> pasman
>>>
>>
>
>
> --
> ------------
> pasman
>

В списке pgsql-general по дате отправления:

Предыдущее
От: pasman pasmański
Дата:
Сообщение: Re: New feature: accumulative functions.
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: In which case PG_VERSION file updates ?