If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > calculate table size

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-01-05, 14:23
skumbhan skumbhan is offline
Registered User
 
Join Date: Sep 2005
Posts: 9
calculate table size

Hi

I have the row count for a table. Is there a way i could find the avergae row size and then use it to calculate table size

row count: X
avg. column size: Y

Table size = X * Y

Please let me know.

Thanks

kayur
Reply With Quote
  #2 (permalink)  
Old 11-02-05, 03:14
przytula przytula is offline
Registered User
 
Join Date: Nov 2004
Posts: 374
table size

sysibm.systables keeps the nbr of rows
syscolumns keeps average column length
make a sum of avg collength * rows
__________________
Best Regards, Guy Przytula
DB2/ORA/SQL Services
DB2 DBA & Advanced DBA Certified
DB2 Dprop Certified
http://users.skynet.be/przytula/dbss.html
Reply With Quote
  #3 (permalink)  
Old 11-02-05, 15:24
skumbhan skumbhan is offline
Registered User
 
Join Date: Sep 2005
Posts: 9
more inof plzz

hi

Thanks.

syscolums is fine. i am a little new... can u give the detail SQl query.. that would be great

kayur
Reply With Quote
  #4 (permalink)  
Old 11-03-05, 03:08
przytula przytula is offline
Registered User
 
Join Date: Nov 2004
Posts: 374
table size

first runstats on table to keep real info
db2 "select sum(c.avgcollen)*t.card from sysibm.syscolumns c,sysibm.systables t where c.tbname='xxxx' and c.tbcreator='yyy' and c.tbname=t.name and c.tbcreator=t.creator group by t.card"
__________________
Best Regards, Guy Przytula
DB2/ORA/SQL Services
DB2 DBA & Advanced DBA Certified
DB2 Dprop Certified
http://users.skynet.be/przytula/dbss.html
Reply With Quote
  #5 (permalink)  
Old 11-03-05, 03:43
juliane26 juliane26 is offline
Registered User
 
Join Date: Oct 2005
Posts: 109
to get the real physical size I'd rather go with no of pages and pagesize.

I mean it could be that you have long rows and just using 2/3rd of a page - so then the result could be somewhat irritating.
__________________
Juliane
Reply With Quote
  #6 (permalink)  
Old 11-03-05, 11:39
chavadb2 chavadb2 is offline
Registered User
 
Join Date: Aug 2004
Posts: 138
do db2 'reorgchk update statistics on table tablename' ..look for TSIZE

this has been posted many times..please search the forum before posting
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On