SQLA numeric vs. double implementation

SQLA numeric vs. double implementation

Post by Rusanu Remu » Fri, 08 May 1998 04:00:00



Hi all,

Do you know which data type is better to use to store currency values in
SQL Anywhere? The MONEY and SMALLMONEY types are actually stored as
NUMERIC(20,4) and NUMERIC(10,4). If I use DOUBLE, can I expect a
improvement on large tables sum's and group by for a  query?
The SQLA server will work on Intel machines and I expect that the DOUBLE
calculations will be much faster.
Maybe a hint about the actual storage of double and numeric in database
will help me to decide.

Best regards,
Remus

 
 
 

SQLA numeric vs. double implementation

Post by Notus Spamu » Tue, 12 May 1998 04:00:00


Several issues...
*  Space -- Double is 8 bytes, the numerics are (I think) 10 and 5
bytes.
*  Faster -- probably not much difference because of other overhead.
*  Easier for you -- Are you ready to handle $123.4499999 ? The numerics
will keep amounts to the penny, double can drift into slight errors.
*  Overflow -- a sum can overflow the numerics (if you are into gross
national products); double won't, but will start losing cents after a
few trillion dollors -- OK, so that's not a problem.
*  Division, multiplication -- If you are calculating interest payments,
sales tax, etc. both schemes need help in rounding to the penny.
*  Space and speed -- by the time you get this answer, disks and cpus
will be cheap enough to do it either way.



> Hi all,

> Do you know which data type is better to use to store currency values in
> SQL Anywhere? The MONEY and SMALLMONEY types are actually stored as
> NUMERIC(20,4) and NUMERIC(10,4). If I use DOUBLE, can I expect a
> improvement on large tables sum's and group by for a  query?
> The SQLA server will work on Intel machines and I expect that the DOUBLE
> calculations will be much faster.
> Maybe a hint about the actual storage of double and numeric in database
> will help me to decide.

> Best regards,
> Remus


 
 
 

1. SQLA numeric vs. double implementation

Hi all,

Do you know which data type is better to use to store currency values in
SQL Anywhere? The MONEY and SMALLMONEY types are actually stored as
NUMERIC(20,4) and NUMERIC(10,4). If I use DOUBLE, can I expect a
improvement on large tables sum's and group by for a  query?
The SQLA server will work on Intel machines and I expect that the DOUBLE
calculations will be much faster.
Maybe a hint about the actual storage of double and numeric in database
will help me to decide.

Best regards,
Remus

2. Tuning and Performance Questions

3. Real vs Double vs Numeric vs Decimal

4. Developing with SQL 2000, installing on SQL 7

5. double precision to numeric overflow error

6. IDAPI and ODAPI

7. postponing index updates in a transaction

8. Operator to compare numeric and double precision

9. Faster NUMERIC implementation

10. Quotes - double vs single

11. help: double quote vs. single quote string delimiter

12. double joins vs composite key