Re: [GENERAL] Numeric performances

2007-06-04 Thread PFC
If you try it with max() you'd likely get less-surprising answers. So it was in fact the type conversions that got timed. Damn. I got outsmarted XDD Rewind : CREATE TEMPORARY TABLE test AS SELECT a::FLOAT AS f, (a::NUMERIC)*100 AS n, a::INTEGER AS i, a::

Re: [GENERAL] Numeric performances

2007-06-04 Thread Tom Lane
Vincenzo Romano <[EMAIL PROTECTED]> writes: > It sounds quite strange to me that numeric is faster than bigint. This test is 100% faulty, because it fails to consider the fact that the accumulator used by sum() isn't necessarily the same type as the input data. In fact we sum ints in a bigint and

Re: [GENERAL] Numeric performances

2007-06-04 Thread Vincenzo Romano
I'm getting more confused. If the algorithm used to do the sum is a drop in the sea, then the resources needed to pass a pointer on the stack are a molecule in the drop! :-) Nonetheless I think that your directions are right: doing actual queries instead of inspecting the algorithms themselves sh

Re: [GENERAL] Numeric performances

2007-06-04 Thread PFC
This is a 32 bit CPU by the way. Consider this : - There are 100K rows - The CPU executes about 3 billion instructions per second if everything is optimum - "SELECT sum(n) FROM test", takes, say 60 ms This gives about 1800 CPU ops per row. A Float addition ve

Re: [GENERAL] Numeric performances

2007-06-04 Thread Vincenzo Romano
Hmmm ... It sounds quite strange to me that numeric is faster than bigint. Even if bigint didn't get hw support in the CPU it should have been faster that numeric as it should be mapped in 2 32-bits integers. Numeric algorithms should be linear (according to the number of digits) in complexity w

Re: [GENERAL] Numeric performances

2007-06-04 Thread PFC
It is. But why do you care? You either have the correctness that NUMERIC gives, or you don't. I suspect it's still useful to know what order of magnitude slower it is. After all if it is 1000x slower (not saying it is), some people may decide it's not worth it or roll their own. Any hint

Re: [GENERAL] Numeric performances

2007-06-04 Thread Lincoln Yeoh
At 01:42 AM 6/1/2007, Alvaro Herrera wrote: Vincenzo Romano escribió: > Hi all. > I'd like to know whether there is any "real world" evaluation (aka test) on > performances of the NUMERIC data type when compared to FLOAT8 and FLOAT4. > The documentation simply says that the former is "much slowe

Re: [GENERAL] Numeric performances

2007-06-01 Thread Martijn van Oosterhout
On Thu, May 31, 2007 at 09:25:27PM +0200, Vincenzo Romano wrote: > On Thursday 31 May 2007 19:42:20 Alvaro Herrera wrote: > > It is. But why do you care? You either have the correctness that > > NUMERIC gives, or you don't. > > Because FLOAT8 can be precise enough for some application and not >

Re: [GENERAL] Numeric performances

2007-05-31 Thread Vincenzo Romano
On Thursday 31 May 2007 19:42:20 Alvaro Herrera wrote: > It is. But why do you care? You either have the correctness that > NUMERIC gives, or you don't. Because FLOAT8 can be precise enough for some application and not enough for other ones. -- Vincenzo Romano -- Maybe Computer will never beco

Re: [GENERAL] Numeric performances

2007-05-31 Thread Alvaro Herrera
Vincenzo Romano escribió: > Hi all. > I'd like to know whether there is any "real world" evaluation (aka test) on > performances of the NUMERIC data type when compared to FLOAT8 and FLOAT4. > The documentation simply says that the former is "much slower" than the latter > ones. It is. But why do