Re: POC: GROUP BY optimization - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: POC: GROUP BY optimization
Date
Msg-id 3bbdd1ee-544d-a549-b0c2-30485d9f6a16@sigaev.ru
Whole thread Raw
In response to Re: POC: GROUP BY optimization  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: POC: GROUP BY optimization
List pgsql-hackers
>> I tried to attack the cost_sort() issues and hope on that basis we can solve 
>> problems with 0002 patch and improve incremental sort patch.
>>
> 
> OK, will do. Thanks for working on this!

I hope, now we have a better cost_sort(). The obvious way is a try all 
combination of pathkeys in get_cheapest_group_keys_order() and choose cheapest 
one by cost_sort(). But it requires N! operations and potentially could be very 
expensive in case of large number of pathkeys and doesn't solve the issue with 
user-knows-what-he-does pathkeys. We could suggest an order of pathkeys as patch 
suggests now and if cost_sort() estimates cost is less than 80% (arbitrary 
chosen) cost of user-suggested pathkeys then it use our else user pathkeys.


-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: ERROR: cannot start subtransactions during a parallel operation
Next
From: Tomas Vondra
Date:
Subject: Re: POC: GROUP BY optimization