Re: [HACKERS] NUMERIC private methods?

2015-03-24 Thread Bruce Momjian
On Sun, Mar 22, 2015 at 04:08:32AM +, Andrew Gierth wrote: Bruce == Bruce Momjian br...@momjian.us writes: ! However, calculations on typenumeric/type values is very slow arithmetic ... is, but calculations ... are Ah, good point. Fixed an applied. Thanks. -- Bruce

Re: [HACKERS] NUMERIC private methods?

2015-03-21 Thread Bruce Momjian
On Thu, Dec 18, 2014 at 11:51:12PM -0500, Tom Lane wrote: If you're doing any sort of higher math or statistics, I stand by my statement that you'd better think rather than just blindly assume that numeric is going to be better for you. A moment's fooling about finds this example, which is

Re: [HACKERS] NUMERIC private methods?

2015-03-21 Thread Andrew Gierth
Bruce == Bruce Momjian br...@momjian.us writes: ! However, calculations on typenumeric/type values is very slow arithmetic ... is, but calculations ... are -- Andrew (irc:RhodiumToad) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread Robert Haas
On Thu, Dec 18, 2014 at 11:51 PM, Tom Lane t...@sss.pgh.pa.us wrote: What it boils down to is that numeric is great for storing given decimal inputs exactly, and it can do exact addition/subtraction/multiplication on those too, but as soon as you get into territory where the result is

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: I think what it boils down to is that several people here (and I'll add my voice to the chorus) are saying, hey, numeric is really useful, and we'd like to be able to manipulate numerics without all the palloc and fmgr overhead, and your response

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread Robert Haas
On Fri, Dec 19, 2014 at 10:56 AM, Tom Lane t...@sss.pgh.pa.us wrote: Well, there are two components to what I'm saying. One is that the example David started with looks like it could use some better-informed consideration about which datatype to use. The other is that numeric leaves quite a

Re: [HACKERS] NUMERIC private methods?

2014-12-19 Thread David Fetter
On Thu, Dec 18, 2014 at 11:51:37PM -0300, Alvaro Herrera wrote: Robert Haas wrote: I think that's ridiculous. You're basically arguing that numeric doesn't offer meaningful advantages over float8, which flies in the face of the fact that essentially every database application I've ever

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Jim Nasby
On 12/18/14, 9:21 AM, Tom Lane wrote: As it stands, no extension can use the numeric type in any non-trivial way without paying a large penalty for repeated pallocs and data copies. Given that the ability to write C extensions easily is one of pg's great strengths, this is a defect that should

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Robert Haas
On Thu, Dec 18, 2014 at 10:21 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andrew Gierth and...@tao11.riddles.org.uk writes: Tom == Tom Lane t...@sss.pgh.pa.us writes: Tom If you're concerned about arithmetic performance, there is a Tom very obvious fix here: use double. Independently of this

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Alvaro Herrera
Robert Haas wrote: I think that's ridiculous. You're basically arguing that numeric doesn't offer meaningful advantages over float8, which flies in the face of the fact that essentially every database application I've ever seen uses numeric and I'm not sure I've ever seen one using float8.

Re: [HACKERS] NUMERIC private methods?

2014-12-18 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Thu, Dec 18, 2014 at 10:21 AM, Tom Lane t...@sss.pgh.pa.us wrote: As the guy who last fooled with the numeric calculation algorithms in any major way, I'm painfully aware that numeric is not necessarily more accurate than double for anything more

Re: [HACKERS] NUMERIC private methods?

2014-12-17 Thread Andrew Gierth
Tom == Tom Lane t...@sss.pgh.pa.us writes: Hmm. You'd want to make add_var, mul_var etc. non-static? Tom -1 for that. possibly with more meaningful names. Tom If you're concerned about arithmetic performance, there is a Tom very obvious fix here: use double. Independently of this

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread Heikki Linnakangas
On 12/16/2014 08:34 AM, David Fetter wrote: Folks, While noodling with some weighted statistics https://github.com/davidfetter/weighted_stats, I noticed I was having to jump through a lot of hoops because of all the private methods in numeric.c, especially NumericVar. Would there be some major

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread Andrew Gierth
Heikki == Heikki Linnakangas hlinnakan...@vmware.com writes: Heikki Looking at the weighed_stats code, this probably illustrates Heikki the hoops you had to jump through: Actually that hoop-jumping expression is almost irrelevant. The part that hurts (and yes, it's performance that's at

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread David Fetter
On Tue, Dec 16, 2014 at 09:01:47AM +, Andrew Gierth wrote: Heikki == Heikki Linnakangas hlinnakan...@vmware.com writes: Heikki Looking at the weighed_stats code, this probably illustrates Heikki the hoops you had to jump through: Actually that hoop-jumping expression is almost

Re: [HACKERS] NUMERIC private methods?

2014-12-16 Thread Tom Lane
Heikki Linnakangas hlinnakan...@vmware.com writes: On 12/16/2014 08:34 AM, David Fetter wrote: While noodling with some weighted statistics https://github.com/davidfetter/weighted_stats, I noticed I was having to jump through a lot of hoops because of all the private methods in numeric.c,