Re: [PATCHES] Avg performance for int8/numeric
От | Mark Kirkwood |
---|---|
Тема | Re: [PATCHES] Avg performance for int8/numeric |
Дата | |
Msg-id | 4567DB5F.9060900@paradise.net.nz обсуждение исходный текст |
Ответ на | Re: [PATCHES] Avg performance for int8/numeric ("Luke Lonergan" <llonergan@greenplum.com>) |
Ответы |
Re: [PATCHES] Avg performance for int8/numeric
|
Список | pgsql-hackers |
Luke Lonergan wrote: > Mark, > > On 11/24/06 6:16 PM, "Mark Kirkwood" <markir@paradise.net.nz> wrote: > >> By way of comparison, here is the first 63 lines for: >> >> select sum(val2) from avgtest > > So, sum() is only alloc'ing 5 times for every row being processed, half of > what avg() is doing. > > Seems like what we need to do is find a way to reuse the temp heaptuple > between calls. > > Yeah - and I'm *guessing* that its due to avg needing to deconstruct/construct a 2 element numeric array every call (whereas sum needs just a single numeric). So some delving into whether it is construct_md_array that can re-use a heaptuple or whether we need to look elsewhere... Also Neil suggested investigating using a single composite type {int8, numeric} for the {N,sum(X)} transition values. This could well be a faster way to do this (not sure how to make it work yet... but it sounds promising...). Cheers Mark
В списке pgsql-hackers по дате отправления: