Re: [WIP Patch] Using 128-bit integers for sum, avg and statistics aggregates
От | Merlin Moncure |
---|---|
Тема | Re: [WIP Patch] Using 128-bit integers for sum, avg and statistics aggregates |
Дата | |
Msg-id | CAHyXU0xbDcX=OsddFxjkgTpwNRYUX0nx8P-fd_sXpJ4Hqhve5w@mail.gmail.com обсуждение исходный текст |
Ответ на | [WIP Patch] Using 128-bit integers for sum, avg and statistics aggregates (Andreas Karlsson <andreas@proxel.se>) |
Список | pgsql-hackers |
On Sat, Oct 25, 2014 at 9:38 AM, Andreas Karlsson <andreas@proxel.se> wrote: > Hi, > > There was recently talk about if we should start using 128-bit integers > (where available) to speed up the aggregate functions over integers which > uses numeric for their internal state. So I hacked together a patch for this > to see what the performance gain would be. > > Previous thread: > http://www.postgresql.org/message-id/20141017182500.GF2075@alap3.anarazel.de > > What the patch does is switching from using numerics in the aggregate state > to int128 and then convert the type from the 128-bit integer in the final > function. > > The functions where we can make use of int128 states are: > > - sum(int8) > - avg(int8) > - var_*(int2) > - var_*(int4) > - stdev_*(int2) > - stdev_*(int4) > > The initial benchmark results look very promising. When summing 10 million > int8 I get a speedup of ~2.5x and similarly for var_samp() on 10 million > int4 I see a speed up of ~3.7x. To me this indicates that it is worth the > extra code. What do you say? Is this worth implementing? yes. merlin
В списке pgsql-hackers по дате отправления: