Re: Improve rowcount estimate for UNNEST(column)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Improve rowcount estimate for UNNEST(column)
Дата
Msg-id 3699083.1701030124@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Improve rowcount estimate for UNNEST(column)  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Improve rowcount estimate for UNNEST(column)  (jian he <jian.universality@gmail.com>)
Список pgsql-hackers
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Sat, 2023-11-25 at 09:19 -0800, Paul A Jungwirth wrote:
>> Here is a patch to improve rowcount estimates for
>> `UNNEST(some_array_column)`. Today we hard code this to 10, but we
>> have statistics about array size, so it's easy to use them.

> The idea sounds good to me.

I didn't read the patch either yet, but it seems like a reasonable idea.

> I didn't test or scrutinize the code, but I noticed that you use
> EXPLAIN in the regression tests.  I think that makes the tests vulnerable
> to changes in the parameters or in the block size.

Yes, this regression test is entirely unacceptable; the numbers will
not be stable enough.  Even aside from the different-settings issue,
you can't rely on ANALYZE deriving exactly the same stats every time.
Usually what we try to do is devise a query where the plan shape
changes because of the better estimate.  That typically will provide
some insulation against small changes in the numerical estimates.

            regards, tom lane



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

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: Improve rowcount estimate for UNNEST(column)
Следующее
От: Peter Smith
Дата:
Сообщение: Re: GUC names in messages