Lists: | pgsql-generalpgsql-hackersPostg스포츠 토토 베트맨SQL |
---|
From: | "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | "Manfred Koizar" <mkoi-pg(at)aon(dot)at>, <shridhar_daithankar(at)persistent(dot)co(dot)in> |
Cc: | <pgsql-hackers(at)postgresql(dot)org>, "pgsql-general" <pgsql-general(at)postgresql(dot)org>, <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] Large databases, performance |
Date: | 2002-10-07 15:42:12 |
Message-ID: | 46C15C39FEB2C44BA555E356FBCD6FA4887A5A@m0114.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general pgsql-hackers pgsql-performance |
> if i'm not mistaken, a char(n)/varchar(n) column is stored as a 32-bit
> integer specifying the length followed by as many characters as the
> length tells. On 32-bit Intel hardware this structure is aligned on a
> 4-byte boundary.
Yes.
> | opc0 char (3) no no 8 4
> | opc1 char (3) no no 8 4
> | opc2 char (3) no no 8 4
> Hackers, do you think it's possible to hack together a quick and dirty
> patch, so that string length is represented by one byte? IOW can a
> database be built that doesn't contain any char/varchar/text value
> longer than 255 characters in the catalog?
Since he is only using fixchar how about doing a fixchar implemetation, that
does not store length at all ? It is the same for every row anyways !
Andreas
From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Zeugswetter Andreas SB SD <ZeugswetterA(at)spardat(dot)at> |
Cc: | Manfred Koizar <mkoi-pg(at)aon(dot)at>, shridhar_daithankar(at)persistent(dot)co(dot)in, pgsql-hackers(at)postgresql(dot)org, pgsql-general <pgsql-general(at)postgresql(dot)org>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: [HACKERS] Large databases, performance |
Date: | 2002-10-08 22:51:11 |
Message-ID: | 20021008225111.GA8663@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general pgsql-hackers Postg스포츠 토토 베트맨SQL |
On Mon, Oct 07, 2002 at 05:42:12PM +0200, Zeugswetter Andreas SB SD wrote:
> > Hackers, do you think it's possible to hack together a quick and dirty
> > patch, so that string length is represented by one byte? IOW can a
> > database be built that doesn't contain any char/varchar/text value
> > longer than 255 characters in the catalog?
>
> Since he is only using fixchar how about doing a fixchar implemetation, that
> does not store length at all ? It is the same for every row anyways !
Remember that in Unicode, 1 char != 1 byte. In fact, any encoding that's not
Latin will have a problem. I guess you could put a warning on it: not for
use for asian character sets. So what do you do if someone tries to insert
such a string anyway?
Perhaps a better approach is to vary the number of bytes used for the
length. So one byte for lengths < 64, two bytes for lengths < 16384.
Unfortunatly, two bits in the length are already used (IIRC) for other
things making it a bit more tricky.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.