Unanswered: How to calculate mas row length in a table
I need to make a estimation about what could be the maximum row length in a table taking into account the data type for all its columns. My first idea was to sum field length in syscat.columns for all the column in the table but I have noticed that that is not accurate because that field can store for example the precision in the colum is decimal and not the length for the column.
Another idea was to get the length for every datatype from field LENGTH in syscat.datatypes, but in this case it is 0 for many of the datatypes, no would need to do some calculations for example for Binray(n) ... etc.
in reorgchk they use :
Table size in bytes. Calculated as the product of the number of rows in the table (CARD) and the average row length. The average row length is computed as the sum of the average column lengths (AVGCOLLEN in SYSCOLUMNS) plus 10 bytes of row overhead. For long fields and LOBs only the approximate length of the descriptor is used. The actual long field or LOB data is not counted in TSIZE.
Best Regards, Guy Przytula
Database Software Consultant
Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
Information Server Datastage Certified http://www.infocura.be