Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-04 Thread Qingqing Zhou
"Tom Lane" <[EMAIL PROTECTED]> wrote > > If we were willing to invent the "varlena2" datum format then we could > save four bytes per numeric, plus reduce numeric's alignment requirement > from int to short which would probably save another byte per value on > average. I'm not sure that that's wo

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Could someone please quantify how much bang we might get for what seems > like quite a lot of bucks? > I appreciate the need for speed, but the saving here strikes me as > marginal at best, unless my instincts are all wrong (quite possible) Two bytes

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Andrew Dunstan
[patches removed] Tom Lane wrote: Simon Riggs <[EMAIL PROTECTED]> writes: It seems straightforward enough to put in an additional test, similar to the ones already there so that if its too big for a decimal we make it a float straight away - only a float can be that big in that case. After

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Jim C. Nasby
On Wed, Nov 02, 2005 at 06:12:37PM -0500, Tom Lane wrote: > Simon Riggs <[EMAIL PROTECTED]> writes: > > It seems straightforward enough to put in an additional test, similar to > > the ones already there so that if its too big for a decimal we make it a > > float straight away - only a float can be

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > It seems straightforward enough to put in an additional test, similar to > the ones already there so that if its too big for a decimal we make it a > float straight away - only a float can be that big in that case. After > that I can't really see what the p

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Simon Riggs
On Wed, 2005-11-02 at 15:09 -0500, Tom Lane wrote: > [ thinks for a moment... ] Actually, neither proposal is going to get > off the ground, because the parser's handling of numeric constants is > predicated on the assumption that type NUMERIC can handle any valid > value of FLOAT8, and so we can

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Simon Riggs
On Wed, 2005-11-02 at 15:09 -0500, Tom Lane wrote: > Simon Riggs <[EMAIL PROTECTED]> writes: > > I wasn't trying to claim the bit assignment made sense. My point was > > that the work to mangle the two fields together to make it make sense > > looked like it would take more CPU (since the standard

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > I wasn't trying to claim the bit assignment made sense. My point was > that the work to mangle the two fields together to make it make sense > looked like it would take more CPU (since the standard representation of > signed integers is different for +ve an

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Simon Riggs
On Wed, 2005-11-02 at 13:46 -0500, Tom Lane wrote: > Simon Riggs <[EMAIL PROTECTED]> writes: > > On Tue, 2005-11-01 at 17:55 -0500, Tom Lane wrote: > >> I don't think it'd be worth having 2 types. Remember that the weight is > >> measured in base-10k digits. Suppose for instance > >>sign

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Tom Lane
Simon Riggs <[EMAIL PROTECTED]> writes: > On Tue, 2005-11-01 at 17:55 -0500, Tom Lane wrote: >> I don't think it'd be worth having 2 types. Remember that the weight is >> measured in base-10k digits. Suppose for instance >> sign1 bit >> weight 7 bits (-64 .. +63) >>

Re: [PATCHES] [HACKERS] Reducing the overhead of NUMERIC data

2005-11-02 Thread Simon Riggs
On Tue, 2005-11-01 at 17:55 -0500, Tom Lane wrote: > "Jim C. Nasby" <[EMAIL PROTECTED]> writes: > > FWIW, most databases I've used limit NUMERIC to 38 digits, presumably to > > fit length info into 1 or 2 bytes. So there's something to be said for a > > small numeric type that has less overhead and