473,395 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Disk Space Calculation for tables

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
4 9348
"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Hi: I am totally new in Sun Solaris. I am not sure someone would like to tell me how to rellocate Sun Solaris disk space where oracle installed? I installed Oracle 8i in Sun Solaris and set...
0
by: Rob Baxter | last post by:
I have a linux server which is hosting several very large (~20GB) databases. In order to save some disk space I dropped an index on one of the larger (InnoDB) tables because it is no longer needed....
3
by: Subodh | last post by:
I've written a SP which does some complex calculations and in the end dumps data into 2 tables (master & detail) When I run this sp for smaller no of IDS (employees i.e for 13000 in Master and...
1
by: Gh! | last post by:
How can I see how much disk space is being occupied by an InnoDB table? Looking into /var/lib/mysql doesn't seem to work anymore for InnoDB tables. Please tell also if there is a way to see how...
5
by: Yasaswi Pulavarti | last post by:
does a command like, db2 drop table tabschema.tabname when run from the Aix prompt reclaim the disk space? Are there any other options? How can we make sure the disk space is reclaimed? Thanks,...
7
by: Barry | last post by:
Hi All, I am a newcommer to Postgresql, currently I am looking at moving a Pick based application across to PostgreSQL. I am using RH Linux and Postgresql 7.3.6 The test system I am using...
1
by: Nils Rennebarth | last post by:
I have a table that is essentially a log where new entries are streaming in continually and from time to time I throw old entries away to keep the table from growing. I understand that in...
5
by: Konstantin Andreev | last post by:
Recently I became interested, - Are the data, bulk loaded in the table with LOAD utility, consume the same disk space as loaded with IMPORT utility? The answer turned out to be NOT ! Here is a...
1
by: siskokid | last post by:
Good afternoon, I have the following question (it might seem silly, but it is important to have it straight) - which one takes more disk space a saved view in a SQL SERVER database (sql query that...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.