Subject Re: [firebird-support] FireBird 2.5 How can i create 1 byte (0-255) column?
Author Dmitry Kuzmenko
Hello, wan30032!

Sunday, March 31, 2013, 7:23:14 PM, you wrote:

w> hello,now i used type is smallint.
w> but there are more than 4,000,000,000 records.
w> so i want to change with like ms sql tinyint.

I need to say some, against char(1) etc. instead of

- rows are being compressed in Firebird.
- record header "without columns" is around ~17 bytes (don't remember
exact size),
so, 2 bytes of smallint here long way off.

- with char(1) character set octets you will always
need to convert integer to char and back.

So, I suggest you to try do the following:

create table with your fields, and smallint instead tinyint.
create table with your fields, and char(1) instead tinyint.

Populate these tables with several million random values.
Check size of tables (gstat -a). Decide what column type to choose.

! you may create test tables only with one column, but there is
Firebird's special behavior when record size is less than 22-23 bytes
(for example, 2 integers, without count of record header size)
Firebird fill data pages less than 50%. Thus, table with that small
row can be greater (in pages) than table with row around 30-40 bytes
(here server fill pages at ~80%).

Dmitry Kuzmenko,