Re: estimating # of distinct values

Поиск
Список
Период
Сортировка
От Florian Pflug
Тема Re: estimating # of distinct values
Дата
Msg-id 0ED6A735-4377-47DC-AEF4-C55F54BD06C4@phlo.org
обсуждение исходный текст
Ответ на Re: estimating # of distinct values  (Nathan Boley <npboley@gmail.com>)
Ответы Re: estimating # of distinct values  (Nathan Boley <npboley@gmail.com>)
Список pgsql-hackers
On Jan19, 2011, at 23:44 , Nathan Boley wrote:
> If you think about it, it's a bit ridiculous to look at the whole table
> *just* to "estimate" ndistinct - if we go that far why dont we just
> store the full distribution and be done with it?

The crucial point that you're missing here is that ndistinct provides an
estimate even if you *don't* have a specific value to search for at hand.
This is way more common than you may think, it e.g. happens every you time
PREPARE are statement with parameters. Even knowing the full distribution
has no advantage in this case - the best you could do is to average the
individual probabilities which gives ... well, 1/ndistinct.

best regards,
Florian Pflug



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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: estimating # of distinct values
Следующее
От: Jan Urbański
Дата:
Сообщение: Re: pl/python refactoring