Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Amit Patel asked how many bytes a row takes, including varchar(80,50) and decimals. Art Kagel said varchar(80,50) uses 1 length byte plus the actual data (up to 81 bytes, as little as 1 when null) and a decimal takes one byte per two digits plus one. Andreas Legner advised creating a test table, checking rowsize in systables and using oncheck -pp for actual slot length.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
AMIT PATEL — source: IBM Community (ConnectedCommunity.org) Informix forum
Hello All,
I need to know how many bytes 1 row will consist?
Will btch_name
varchar(
80
,
50) take 80 Bytes ? And if this field has only 30 character then also it will space 80 bytes only?
And if we have decimal (10,2) and decimal(2,0) then how many bytes both will have?
create table RD_SIMD_BTCH (btch_numb
integer
not null,
btch_name
varchar(
80
,
50)
not null,
file_name
varchar(
50
,
0)
not null,
mail_to
varchar(
50
,
0)
not null,
clnt_id
char(1)
not null,
sent_flag
char(1)
not null,
resp_flag
char(1)
not null,
crtd_dttm datetime year to second
not null,
crtd_by char(12)
not null,
last_chng_dttm datetime year to second
not null,
last_chng_by char(12)
not null,
);
Kindly reply;
Thanks
Amit Patel
------------------------------
AMIT PATEL
------------------------------
#Informix
↪ replying to AMIT PATEL
Art Kagel — source: IBM Community (ConnectedCommunity.org) Informix forum
Varchat(80,50) means that unless the value is null, at least 51 bytes will be allocated with a maximum size of 81 bytes [80 characters us a one byte length byte). If null then only one byte will be stored.
Art
↪ replying to AMIT PATEL
Art Kagel — source: IBM Community (ConnectedCommunity.org) Informix forum
Oops, so decimals take up one byte foe each two digits plus one byte. So decimal(2, 0) uses two bytes, decimal(10,5) uses 6 bytes.
Art
↪ replying to AMIT PATEL
Andreas Legner — source: IBM Community (ConnectedCommunity.org) Informix forum
You always can create a test table, with either the full schema or only a single column of a specifc type you're interested in.
Then query rowsize from systables for this table, for the *maximum* row size (which is what a row would consume when loaded into session memory during query processing.)
If variable length fields are part of your test, e.g. varchar, you then would insert a minimal test row (e.g. all fields null) and look at that row using 'oncheck -pp'.
E.g.
dbaccess stores7 <<!
create table test_rowsize(d decimal(10,5),v varchar(80,50));
select rowsize from systables where tabname='test_rowsize';
insert into test_rowsize values (null,null);!
$ oncheck -pp stores7:test_rowsize 0x101-> slot len would be the actual space consumed by this row in the data page.
HTH,
Andreas
------------------------------
Andreas Legner
------------------------------
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.