Re: POC: GROUP BY optimization

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-12-28T08:47:35Z
Lists: pgsql-hackers

Attachments

On 9/2/20 9:12 PM, Tomas Vondra wrote:
 > We could simply use the input "tuples" value here, and then divide the
 > current and previous estimate to calculate the number of new groups.

Performing a review of this patch I made a number of changes (see 
cleanup.txt). Maybe it will be useful.
As I see, the code, which implements the main idea, is quite stable. 
Doubts localized in the cost estimation routine. Maybe try to finish 
this work by implementing an conservative strategy to a cost estimation 
of sorting?

-- 
regards,
Andrey Lepikhov
Postgres Professional

Commits

  1. Optimize order of GROUP BY keys