By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,611 Members | 2,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,611 IT Pros & Developers. It's quick & easy.

Disk Space Calculation for tables

P: n/a
Hi,

Can anyone tell me how to calculate the ctual disk space needed for a
table? The record length and number of records are known.
A rough estimate of the disk space would suffice.

Please help.

Thanks,
Sandip.

Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"sandip" <sa********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,

Can anyone tell me how to calculate the ctual disk space needed for a
table? The record length and number of records are known.
A rough estimate of the disk space would suffice.

Please help.

Thanks,
Sandip.

The usable space on a 4K page is about 4000 bytes. The default free space is
10% (if set to -1).

In case you didn't already know, make sure you add one byte for all nullable
columns, and 2 bytes for varchar. Obviously for varchar, you will need the
average actual data length.

None of this includes space for indexes.
Nov 12 '05 #2

P: n/a
You need to compute how many rows will fit on each page. The
"Administration Guide - Planning" has detailed information about how to
do this. See the section "Space requirements for user table data" for
detailed information.

A quick estimate for a 4k page size is:
(1+freespace percentage)*num rows/(int(4028/(rowsize+10)))

Don't forget to plan for space for indexes.

Rows with varchar data in them will, as a general rule, take up less
space than the maximum. This will (usually) allow more rows per page
than the basic calculation indicates. Use the average length of the
varchar column when computing row size.

There are also some other some other considerations that come into play
when the row size is a large percentage of the page size. These relate
the data manager's ability to find space for a new row to be inserted.
At the other end of the scale, if the row size is very small, then you
can hit the limit of maximum rows on a page.
Phil Sherman
sandip wrote:
Hi,

Can anyone tell me how to calculate the ctual disk space needed for a
table? The record length and number of records are known.
A rough estimate of the disk space would suffice.

Please help.

Thanks,
Sandip.

Nov 12 '05 #3

P: n/a
An easy cheap way to do this is:
1) Create a dummy tablespace SMS/DMS as you need. You'll drop after.
2) create the table and define columns as best as you know (type, size,
nullable). You could drop it after
3) On the Control Center, select the table, ge the drop down menu and select
Estimate size
4) On the next screen, select metric (Page, MB, GB). Choose the no. of
projected rows, click refresh and it should give you a close estimate of the
expected size.
Note that you could define projected indexes and get their estimate size
also.
HTH, Pierre.

--
Pierre Saint-Jacques
SES Consultants Inc.
514-737-4515
"sandip" <sa********@gmail.com> a écrit dans le message de news:
11**********************@o13g2000cwo.googlegroups. com...
Hi,

Can anyone tell me how to calculate the ctual disk space needed for a
table? The record length and number of records are known.
A rough estimate of the disk space would suffice.

Please help.

Thanks,
Sandip.


Nov 12 '05 #4

P: n/a
db2 "select substr(a.tabname,1,15) tabname, (CAST(a.npages AS BIGINT) *
b.pagesize)/1024/1024 mbytes from syscat.tables a, syscat.tablespaces b
where a.tbspaceid = b.tbspaceid and tabschema = '<tabschema>' and
tabname = '<tabname>'"

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.