Re: POC: GROUP BY optimization
От | Andrey Lepikhov |
---|---|
Тема | Re: POC: GROUP BY optimization |
Дата | |
Msg-id | 9acd27e9-3372-4d78-b9bc-73e407b8a007@postgrespro.ru обсуждение исходный текст |
Ответ на | Re: POC: GROUP BY optimization (Tomas Vondra <tomas.vondra@enterprisedb.com>) |
Ответы |
Re: POC: GROUP BY optimization
|
Список | pgsql-hackers |
On 20/7/2023 18:46, Tomas Vondra wrote: > 2) estimating quicksort comparisons - This relies on ndistinct > estimates, and I'm not sure how much more reliable we can make those. > Probably not much :-( Not sure what to do about this, the only thing I > can think of is to track "reliability" of the estimates and only do the > reordering if we have high confidence in the estimates. That means we'll > miss some optimization opportunities, but it should limit the risk. According to this issue, I see two options: 1. Go through the grouping column list and find the most reliable one. If we have a unique column or column with statistics on the number of distinct values, which is significantly more than ndistincts for other grouping columns, we can place this column as the first in the grouping. It should guarantee the reliability of such a decision, isn't it? 2. If we have extended statistics on distinct values and these statistics cover some set of first columns in the grouping list, we can optimize these positions. It also looks reliable. Any thoughts? -- regards, Andrey Lepikhov Postgres Professional
В списке pgsql-hackers по дате отправления: