Ravi sharma
Ravi sharma

Reputation: 11

How to calculate Row size of table in db2

We have to do some analysis on some tables for that we have to find out the maximum possible row size of each table in db2 db.

Please let us know..

Upvotes: 0

Views: 1274

Answers (2)

Richard Reppert
Richard Reppert

Reputation: 1

Look at the system catalog. There is a column avgrowsize in syscat.tables. This is an average, effected by the lengths of the various VARCHAR columns, but this is a good starting point for your calculations.

Upvotes: 0

data_henrik
data_henrik

Reputation: 17118

Check out the Db2 documentation for CREATE TABLE. It contains the lengthy formula to compute the row size for a table. It depends on many attributes like

  • the type of table,
  • the column data types,
  • if they allow NULL,
  • if value compression is enabled,
  • ...

The maximum possible row size depends on the page size, but there is also a column count limit.

If you don't need it precisely, you can sum up the byte count for each column data type in your table, add some extrac bytes. Then, make sure it is below 1/4 of the page size.

Upvotes: 1

Related Questions