Re: Weird function behavior from Sept 11 snapshot
От | Thomas Lockhart |
---|---|
Тема | Re: Weird function behavior from Sept 11 snapshot |
Дата | |
Msg-id | 39BE393B.38CA2E71@alumni.caltech.edu обсуждение исходный текст |
Ответ на | Weird function behavior from Sept 11 snapshot (Mike Mascari <mascarm@mascari.com>) |
Ответы |
Re: Weird function behavior from Sept 11 snapshot
|
Список | pgsql-hackers |
> Is this correct behavior? All of the regression tests pass on the > snapshot version, BTW. This is the expected behavior, and is "correct". There was a change recently to the aggregate functions to make them more robust. So sum(int4) now calculates and returns a numeric result rather than an int4. The problem is that numeric is extremely slow compared to an int4 calculation, and I'd like us to consider doing the calculation in int4 (downside: silent overflow when dealing with non-trivial data), int8 (downside: no support on a few platforms), or float8 (downside: silent truncation on non-trivial data). Tom, do you recall measuring the performance difference on aggregate functions between int4 and numeric for small-value cases? We probably don't want to take order-of-magnitude performance hits to get this more correct behavior, but I'm not sure what the performance actually is. btw, Mike's function works when defined as create function c(int4) returns int4 as 'select cast(sum(key) as int4) from test' language 'sql'; - Thomas
В списке pgsql-hackers по дате отправления: