Re: creating new aggregate function
От | Webb Sprague |
---|---|
Тема | Re: creating new aggregate function |
Дата | |
Msg-id | b11ea23c0802291132s272e0680s8e768645f32e4f77@mail.gmail.com обсуждение исходный текст |
Ответ на | creating new aggregate function (Justin <justin@emproshunts.com>) |
Список | pgsql-hackers |
This probably belongs on General, but On Fri, Feb 29, 2008 at 9:11 AM, Justin <justin@emproshunts.com> wrote: > Need help and direction creating new aggregate functions. > > We need to add more average functions for both scientific and finical > purposes > > RMS for electrical measurement purposes > Mode for both electrical and finical > Weighted Average finical purposes > Generalized mean for electrical measurement purposes > Geometric mean for electrical measurement purposes > Harmonic mean for electrical measurement purposes > > what would be the best way to create these new functions?? Have you already read the documentation on creating aggregates? Have you tried something and it didn't work, or are you interested in design ideas? I would just knock together something in plpgsql. If you have trouble, send the specific questions to the list. "best" ? C is fastest, etc -- what kind of tradeoffs do you need to satisfy? One thing worth thinking about is using arrays to carry state from one function call to the next in an aggregate; this is how the function used in the average aggregate keeps track of both the running total and the number of rows. The Stdev uses a three item array similarly. > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend >
В списке pgsql-hackers по дате отправления: