Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Table Size

Table Size

Table Size

Is is possbile to calcuate table size from the syscat tables?  If so, how would one go about doing so?


RE: Table Size

   You can check the table size by running a REORGCHK with update statistics. then one of the values displayed for each column is TSIZE that is the table size so just run runstats for the desire table.
## reorgchk update statistics on table schemaname.urtabname

Remember to update your statistics before you select any value from the syscat tables.
If you check the documentation for REORGCHK it will tell you the formula to calculate TSIZE from syscat tables.
It is calculated by multiplying the number of rows found in the table ie, CARD value from syscat.tables for your table, with the average row lenght. To calculate average row length you have to see the syscat.columns table. Avg row lenght is calculated as sum of avg column length, ie, AVGCOLLEN value from syscat.columns for your table, with a row overhead of 10 per column.
So the formula is CARD*(SUM(AVGCOLLEN)+10)
eg if CARD=9 and sum(avgcollen) is 51 TSIZE is 9*(51+10)=549.

the sql statement for that would be
select a.CARD * (sum(b.AVGCOLLEN)+10) from syscat.tables as a, syscat.columns as b where a.TABNAME ='urtabname' and b.TABNAME = 'urtabname' group by a.CARD

Hope you find this useful

RE: Table Size

Thanks, one more question.  Does this provide size in bytes?  Thanks again for your help.

RE: Table Size

Yes it does give the size in bytes

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close