473,669 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Estimate tablespace size

Hi all,

I am now doing development using DB2.

Q1.
There is one tablespace to store 5 tables.

But, when in production, there will be one tablespace for EACH of the
tables.

Is there any method to ...
for example, find out the row-size of each of the table
so that I can estimate the tablespace size for each table.

Assuming that the development record volume is 1% of the production
volume.
Q2.
Moreover, just for curiorsity, since now 5 tables are sharing the same
tablespace,
is there any way to know how much each table is consuming the
tablespace ?
Thanks in advance.
Alvin SIU

May 15 '07 #1
4 13230
On May 15, 9:10 am, Alvin SIU <alvin....@gmai l.comwrote:
Hi all,

I am now doing development using DB2.

Q1.
There is one tablespace to store 5 tables.

But, when in production, there will be one tablespace for EACH of the
tables.

Is there any method to ...
for example, find out the row-size of each of the table
so that I can estimate the tablespace size for each table.

Assuming that the development record volume is 1% of the production
volume.

Q2.
Moreover, just for curiorsity, since now 5 tables are sharing the same
tablespace,
is there any way to know how much each table is consuming the
tablespace ?

Thanks in advance.
Alvin SIU
DB2CC can do that, estimate per table.
If it is SMS, easy to find out. It is just different files.
If it is DMS, use stats to find out.

May 15 '07 #2
Alvin SIU wrote:
Hi all,

I am now doing development using DB2.

Q1.
There is one tablespace to store 5 tables.

But, when in production, there will be one tablespace for EACH of the
tables.

Is there any method to ...
for example, find out the row-size of each of the table
so that I can estimate the tablespace size for each table.
The system catalog views, in particular the SYSCAT.TABLES view [1] are
your friend here. Ensure you have performed RUNSTATS on each of the
tables, and then try the following query:

SELECT AVGROWSIZE
FROM SYSCAT.TABLES
WHERE TABSCHEMA = 'MYSCHEMA'
AND TABNAME = 'MYTABLE'

This will return the "average row size" for the table in question.
Naturally, if you have variable size columns in the table (VARCHAR et
al.) then this may differ from your production tables (depends on how
representative your development data is).
Assuming that the development record volume is 1% of the production
volume.
Assuming the above, simply multiply the values returned by the queries
below by 100 to obtain the production value...
Q2.
Moreover, just for curiorsity, since now 5 tables are sharing the same
tablespace,
is there any way to know how much each table is consuming the
tablespace ?
The following query will tell you how many pages a table is currently
using in its tablespace:

SELECT FPAGES
FROM SYSCAT.TABLES
WHERE TABSCHEMA = 'MYSCHEMA'
AND TABNAME = 'MYTABLE'

To find out the number of bytes this represents you need to know the
page size of the tablespace:

SELECT T.FPAGES * TS.PAGESIZE
FROM
SYSCAT.TABLES T
INNER JOIN SYSCAT.TABLESPA CES TS
ON T.TBSPACEID = TS.TBSPACEID
WHERE T.TABSCHEMA = 'MYSCHEMA'
AND T.TABNAME = 'MYTABLE'

You can also use NPAGES instead of FPAGES to find out the number of
pages containing row data as opposed to the total number of pages taken
up by the table. Note that even in this case, the figure returned is
not necessarily the same as the size of the data held by the table -
for example, there may be unused space at the end of a page.

If you have indexes on these tables, you can also calculate the
approximate size of these using the SYSCAT.INDEXES view [2] (see the
NLEAF column) although if indexes are in a separate tablespace to the
table's data one must take care to join to SYSCAT.TABLESPA CES via
SYSCAT.TABLES.I NDEX_TBSPACE.

Finally, if the tables contain LOB data, you may have a problem. The
LONG_TBSPACE column of the SYSCAT.TABLES view will tell you the
tablespace in which long data for that table is stored, but I'm not
sure if there's a way to tell how many pages of long data a table is
currently using (unless it's included in NPAGES or FPAGES, but the
documentation doesn't make this clear).

[1] http://tinyurl.com/2yt7yk
[2] http://tinyurl.com/2zecvf
HTH,

Dave.

--

May 15 '07 #3
Alvin SIU wrote:
Hi all,

I am now doing development using DB2.

Q1.
There is one tablespace to store 5 tables.

But, when in production, there will be one tablespace for EACH of the
tables.

Is there any method to ...
for example, find out the row-size of each of the table
so that I can estimate the tablespace size for each table.

Assuming that the development record volume is 1% of the production
volume.
Q2.
Moreover, just for curiorsity, since now 5 tables are sharing the same
tablespace,
is there any way to know how much each table is consuming the
tablespace ?
Which version of DB2 are you using? What's your platform?

It is usual to use 1 table = 1 tablespace on DB2 z/OS. On DB2 LUW, it is
rather unusual...

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
May 15 '07 #4
HI Knut,

Answer your question about why 1 tbs per table.

It is because my system is a data warehouse system built many years
ago.

Each table is very large.
I do not know why the DBA will design in this way.
But, maybe one reason is the filesize constraint.
Maybe at that good old days, putting 2 large tables together will need
a large-large size which may break some size limit.

Another possible reason is maybe for easy management.
When putting 2 tables in 1 tbs, if one table gets error when loading
(we use the "load" command),
the other table will be suffer because the whole tbs will be in
"loading pending" state.
Then, users will compliant why the table-B loading error making me not
able to use table-A.

Therefore, 1 tbs per table can have a "loose coupling" adv.
Only the affected table is suffered without affecting other tables.

Feel free to discuss.
Alvin SIU

May 28 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10243
by: Stanley Sinclair | last post by:
About to create a table which will "include" a BLOB. Am not sure how large to make the container and the tablespace. What I see says that BLOB is stored "separately." However, I don't know where. With a table kinda like: CREATE TABLE BLOB_TABLE ( BLOB_ID INT,
12
3243
by: xixi | last post by:
hi, i am using db2 udb v8.1 on windows, i try to use control center to estimate table size, but some of them showing 0 rows even though there are 6000 rows in the table, some of them showing correctly, so why is that?
4
6408
by: Fan Ruo Xin | last post by:
How to estimate the size of log space when I need to run "INSERT INTO tgt_tbl SELECT * FROM src_tbl WHERE..." ? What is the difference of before image between the above INSERT stmt and the following: begin transaction INSERT INTO tgt_tbl VALUES (...); ... INSERT INTO tgt_tbl VALUES (...); end transaction;
1
4693
by: Bruce Pullen | last post by:
db27.2 (fp13) on AIX 5.2. The following error is generated when attempting a reorg or, more precisely, when the file associated with the reorg tablespace reaches 1Gb. SQL2216N SQL error "-968" occurred while reorganizing a database table. I can happily export to a file > 1Gb as the same userid (who created
0
2009
by: Yuri Ludevig | last post by:
I recently was asked to switch from using raw lv's to file system and the first problem I encountered was with calculating the exact size for tablespaces. This is an example: I create LV and mount a file system over it. Let's say my page size is 16K. I tried to divide the free space (from df -k command) and use this number in my create tablespace command. As it turned out I couldn't use all the space (in case of 4.6 G file there was...
2
2742
by: ari | last post by:
Hi! Normally Google helps a lot with these simple questions, but now I cannot get correct search words. So I try here: I have db2 udb 8.1 fix pack 6, and it is on windows 2003 server. - what is the maximum table space size? 64GB? - what is the maximum container size for tablespace?
0
1483
by: Lan W via DBMonster.com | last post by:
I tried to restore DB2 UDB two databases into two different instances on AIX server. the raw devices size of rShortSpace0 and rShortSpace1 on the two instances are the same. # lsvg -l datavg datavg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT db2templv jfs 52 52 1 open/syncd /db2temp loglv00 jfslog 1 1 1 open/syncd N/A RegSpace0 jfs ...
0
1327
by: ramesh jampala | last post by:
Hello Gurus, I know that we can get tablespace used and free page information using " db2 list tablespaces show detail" command. But this information should be stored somewhere in catalog tables. If we can retrieve this information only using snapshot functions, where this information is physically stored. Thanks
1
2015
by: shraddhamhatre | last post by:
Hi friends I am new in oracle , can you pls help me to know what to keep size of temp and undo tablespace? And also wanted to know is there any inbuild script of oracle which will give the tablespace/database information which is required before migration on database from one version to another? Thanks Shraddha
0
8462
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
8893
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
8802
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
8658
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
7405
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.