Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics

Поиск
Список
Период
Сортировка
От Nathan Boley
Тема Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics
Дата
Msg-id 6fa3b6e20806101216n5dd675eak954f54701a6ce268@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>> If we query on values that aren't in the table, the planner will
>> always overestimate the expected number of returned rows because it (
>> implicitly ) assumes that every query will return at least 1 record.
>
> That's intentional and should not be changed.

Why?  What if ( somehow ) we knew that there was a 90% chance that
query would return an empty result set on a big table with 20 non-mcv
distinct values. Currently the planner would always choose a seq scan,
where an index scan might be better. Better yet, couldn't that be
optimized to *if record exists, execute seq scan*. That being said, I
think queries are generally searching for values that exist in the
table.

> I can't see the value of allowing fractional-row estimates anyway.

Neither can I, but I could probably think of cases where knowing the
SD of the result set could result in better plans.

-Nathan


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Proposal - improve eqsel estimates by including histogram bucket numdistinct statistics