From: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Auto selection of internal representation for integer NUMERIC |
Date: | 2006-07-03 10:11:34 |
Message-ID: | 20060703182129.5687.ITAGAKI.TAKAHIRO@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Hackers,
I think about mapping NUMERIC(n) to fixed size integers corresponding to n:
- n < 4 to int2
- 5 <= n < 9 to int4
- 10 <= n < 18 to int8
- 19 <= n to original numeric
NUMERIC is not so efficient datatypes compared to fixed size integers.
If the auto selection is avaliable, users don't have to care about integer
types; they can always use NUMERICs.
In particular, this is useful for oracle users. Oracle recommends to use
NUMBER(n, p) for all the case where numerics are required. So they try to
use NUMERIC on PostgreSQL instead of NUMBER. But NUMERIC is not the best
alternative to a short integer NUMBER.
Is this worth trying and acceptable? This thought is not wanted if users
choise int2/4/8 carefully -- but it is rare case from my experience :-(
In addition, treating NaN value is an issue. NaN is supported on NUMERIC,
but there are complexities to do the same on fixed size integers.
Comments and suggestions are welcome.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2006-07-03 10:12:56 | Re: odd 7.4 build failure on new sparc machine |
Previous Message | Andrew Dunstan | 2006-07-03 09:59:01 | Re: ADD/DROPS INHERIT (actually INHERIT / NO INHERIT) |