Re: Use zero for nullness estimates of system attributes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Use zero for nullness estimates of system attributes
Дата
Msg-id 23976.1548517484@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Use zero for nullness estimates of system attributes  (Jim Finnerty <jfinnert@amazon.com>)
Список pgsql-hackers
Jim Finnerty <jfinnert@amazon.com> writes:
> It's related, but what I was referring to applies even to the uncorrelated
> case: suppose you have something like:

> select x, sum(z) 
> from t
> where
>     x > 5 and y in ('a', 'b', 'c')
> group by x;

> let's say that 'a', 'b', and 'c' are not frequent values of y, so the
> estimated selectivity is based on the n_distinct of y and the 3 values.  Now
> imagine that x > 5 is applied first.  That reduces the number of qualifying
> rows by the selectivity of (x > 5), but it may also reduce the number of
> distinct values of y.  If it reduces the n_distinct of y, then the IN
> predicate selectivity should be adjusted also.

I don't actually think that's a foregone conclusion.  If the two where
clauses are in fact independent, then simply multiplying their
selectivities together is the right thing.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [Patch] Log10 and hyperbolic functions for SQL:2016 compliance
Следующее
От: Tom Lane
Дата:
Сообщение: Opossum vs. float4 NaN