Re: Additional Statistics Hooks

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: Additional Statistics Hooks
Дата
Msg-id CAFjFpRcwcAtMvFXpdL6chMS7Q-+-n8xiznSeenm4C_xug8zyFg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Additional Statistics Hooks  (Mat Arye <mat@timescale.com>)
Ответы Re: Additional Statistics Hooks  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Список pgsql-hackers
On Tue, Mar 13, 2018 at 8:55 PM, Mat Arye <mat@timescale.com> wrote:
>>
>> Like cost associated with a function, we may associate mapping
>> cardinality with a function. It tells how many distinct input values
>> map to 1 output value. By input value, I mean input argument tuple. In
>> Mat's case the mapping cardinality will be 12. The number of distinct
>> values that function may output is estimated as number of estimated
>> rows / mapping cardinality of that function.
>
>
> I think this is complicated by the fact that the mapping cardinality is not
> a constant per function
> but depends on the constant given as the first argument to the function and
> the granularity of the
> underlying data (do you have a second-granularity or microsecond
> granularity). I actually think the logic for the
> estimate here should be the (max(time)-min(time))/interval. I think to be
> general you need to allow functions on statistics to determine the estimate.
>

I think my solution was quite short-sighted. You are right. We need a
function taking statistics about the input argument as input and
output the statistics about the output. The planner can then use this
statistics to arrive at various estimates.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: INOUT parameters in procedures
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs