Subject Re: [firebird-support] Is this possible ?
Author Michael Ludwig
svanderclock schrieb am 31.05.2010 um 12:46:29 (-0000):
> I need to store 25 values (integer) in 25 differents fields.
> all the value are from 0 to 255 (8bit). their will be at the end more
> than 50 000 000 rows in the table !
>
> What field definition to choose to store only 8 bit ?

As far as I know, there is no 8-bit integer field in Firebird (such as
TINYINT as in MySQL). You might consider using a number of SMALLINT or
INTEGER to accommodate 2 respectively 4 fields each. This will require
some bit operations (BIN_SHL, BIN_AND, BIN_OR, etc), and it will also
suggest encapsulation of data access in stored procedures.

> after i will select the field only in the way
>
> select ID from table colors where
> color1 > 120 and color1 < 140 and
> color2 > 160 and color2 < 180 and
> color3 > 60 and color3 < 80 and
> ...
> color25 > 20 and color25 < 40;

To be adapted and moved to the SP, I'd say.

> is this will be acceptable under firebird ?
> or too much heavy ? did i will need to create only
> one multi column index or 25 single column index ?

I would try and figure out which of your 25 fields will (a) be present
in each and every query, and (b) offer sufficient selectivity for index
efficiency. Then I would build that index, and no others.

--
Michael Ludwig