473,725 Members | 2,169 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9405
"sandip" <sa********@gma il.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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
"Administra tion 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********@gma il.com> a écrit dans le message de news:
11************* *********@o13g2 00...legr 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.


Nov 12 '05 #4
db2 "select substr(a.tabnam e,1,15) tabname, (CAST(a.npages AS BIGINT) *
b.pagesize)/1024/1024 mbytes from syscat.tables a, syscat.tablespa ces 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
4483
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 Oracle main table space called TABLES in unix disk space /dpp/live01. From the following, it's quite easy to see that the disk space of /dpp/live01 is 97%.Therefore how can i move some disk space of SWAP to /dpp/live01 without losing
0
1991
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. It took about 30 minutes for MySQL to drop the index, during which time I saw the free disk space decrease. I didn't think anything of it while the drop operation was running because I figured it was some kind of temp file being used by the drop...
3
2010
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 60000 records in detail table) it takes around 3-4 hrs and if I run for all employees in the database (i.e. abt 60000 records in master and 180000 records in detail table) then it takes around 10hrs to complete. I'm using temp table to hold data...
1
5145
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 much space is occupied by a particular row or column of a table. Thanks
5
7584
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, Yasaswi
7
1615
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 has a 2 channel raid card with a disk pack connected to each channel. The OS and Postgresql sits on its own internal disk.
1
3432
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 addition to issue a DELETE FROM log WHERE date < xxx I also need to issue a VACUUM log so that new entries will use the space of deleted entries. Now I want to reserve a certain amount of disk storage to hold the log table. So I first let the table...
5
2174
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 nutshell description of the test. The testing was done at "DB2/LINUX 8.2.3". Tables for tests: F4106 has 5203 rows, 32 columns. F42199 has 1399252 rows, 245 columns.
1
1356
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 will woutput columns and rows) or a table itself stored in a SQL SERVER database that contains the same rows and columns as the view? The thing is that the data in the table and the view is stored actually in other tables where I use a many-to-many...
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.