Re: Improve rowcount estimate for UNNEST(column)

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: Improve rowcount estimate for UNNEST(column)
Дата
Msg-id bdaf96bfbdd9a8a32bba43f91d1ac6dcfd237d35.camel@cybertec.at
обсуждение исходный текст
Ответ на Improve rowcount estimate for UNNEST(column)  (Paul A Jungwirth <pj@illuminatedcomputing.com>)
Ответы Re: Improve rowcount estimate for UNNEST(column)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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.
>
> I've seen plans where this would make a difference. If the array has
> only 1 or 2 elements, then overestimating the rowcount by 10 leads to
> unnecessary seqscans downstream. I can see how an underestimate would
> cause issues too.

The idea sounds good to me.
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.
Perhaps you can write a function that runs EXPLAIN and extracts just the
row count.  That should be stable enough.

Yours,
Laurenz Albe



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Missing docs on AT TIME ZONE precedence?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Improve rowcount estimate for UNNEST(column)