Subject Re: [ib-support] Re: Char set & collation order ... I'm lost!
Author Paul Schmidt
On 26 Dec 2001, at 17:43, Ann W. Harrison wrote:

> At 10:30 AM 12/24/2001 -0500, Paul Schmidt wrote:
> >create domain D_BOOL as integer DEFAULT 0 CHECK (VALUE IN
> >(0,1)) not null;
> >
> >This effectively creates a boolean type, although it uses more
> >storage then it needs to.
> If you make the type char(1), it will be about the same as
> the optimal ... at the moment we don't shuffle the physical
> representation to cluster like types together. If we did,
> then the first boolean field would take a byte and the next
> seven would be free.... which seems crazy given the price
> of disks...

I wasn't sure whether a char(1) worked like a C style char, or
whether it would do something goofy, like give an incompatable
types error, when it saw the value. I'll have to check and see, I
may be able to save some storage. Neat thing about domains, is
that you can change the domain without needing to reload the table.

What we need is a bool type which assigns a single byte, using
the first bit of that byte, then when the next boolean is created it
uses the second bit, until you either run out of boolean fields, or
the byte is full. If the byte is full, it assigns another byte. A
number of other databases do this, so perhaps we can too.


Paul Schmidt
Tricat Technologies