Re: Additional size of hash table is alway zero for hash aggregates
От
Jeff Davis
Тема
Re: Additional size of hash table is alway zero for hash aggregates
Дата
Msg-id
51fa3c3c60988a51ee56726704fb628f7cb9bb1e.camel@j-davis.com
Ответ на
Список
Дерево обсуждения
Additional size of hash table is alway zero for hash aggregates Pengzhou Tang <ptang@pivotal.io>
Re: Additional size of hash table is alway zero for hash aggregates Andres Freund <andres@anarazel.de>
Re: Additional size of hash table is alway zero for hash aggregates Justin Pryzby <pryzby@telsasoft.com>
Re: Additional size of hash table is alway zero for hash aggregates Andrew Gierth <andrew@tao11.riddles.org.uk>
Re: Additional size of hash table is alway zero for hash aggregates Andres Freund <andres@anarazel.de>
Re: Additional size of hash table is alway zero for hash aggregates Jeff Davis <pgsql@j-davis.com>
Re: Additional size of hash table is alway zero for hash aggregates Andres Freund <andres@anarazel.de>
Re: Additional size of hash table is alway zero for hash aggregates Jeff Davis <pgsql@j-davis.com>
Re: Additional size of hash table is alway zero for hash aggregates Andres Freund <andres@anarazel.de>
Re: Additional size of hash table is alway zero for hash aggregates Pengzhou Tang <ptang@pivotal.io>
Re: Additional size of hash table is alway zero for hash aggregates Pengzhou Tang <ptang@pivotal.io>
Re: Additional size of hash table is alway zero for hash aggregates Pengzhou Tang <ptang@pivotal.io>
On Fri, 2020-03-13 at 00:34 +0000, Andrew Gierth wrote: > > > > > > "Justin" == Justin Pryzby writes: > > > On Thu, Mar 12, 2020 at 12:16:26PM -0700, Andres Freund wrote: > >> Indeed, that's incorrect. Causes the number of buckets for the > >> hashtable to be set higher - the size is just used for that. I'm > a It's also used to set the 'entrysize' field of the TupleHashTable, which doesn't appear to be used for anything? Maybe we should just remove that field... it confused me for a moment as I was looking into this. > >> bit wary of changing this in the stable branches - could cause > >> performance changes? > > I think (offhand, not tested) that the number of buckets would only > be > affected if the (planner-supplied) numGroups value would cause > work_mem > to be exceeded; the planner doesn't plan a hashagg at all in that > Now that we have Disk-based HashAgg, which already tries to choose the number of buckets with work_mem in mind; and no other caller specifies non-zero additionalsize, why not just get rid of that argument completely? It can still sanity check against work_mem for the sake of other callers. But it doesn't need 'additionalsize' to do so. Or, we can keep the 'additionalsize' argument but put it to work store the AggStatePerGroupData inline in the hash table. That would allow us to remove the 'additional' pointer from TupleHashEntryData, saving 8 bytes plus the chunk header for every group. That sounds very tempting. If we want to get even more clever, we could try to squish AggStatePerGroupData into 8 bytes by putting the flags (transValueIsNull and noTransValue) into unused bits of the Datum. That would work if the transtype is by-ref (low bits if pointer will be unused), or if the type's size is less than 8, or if the particular aggregate doesn't need either of those booleans. It would get messy, but saving 8 bytes per group is non-trivial. Regards, Jeff Davis
В списке pgsql-hackers по дате отправления
От: Andres Freund
Дата:
От: Peter Geoghegan
Дата: