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 > Tablespace Used pages remain constant

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-30-11, 04:37
poojithas poojithas is offline
Registered User
 
Join Date: Oct 2010
Posts: 4
Tablespace Used pages remain constant

Hi ,
I'm using db2 9.7 on Ubuntu Linux. In spite of lot of data rows insertion, my table space used pages is showing same value. Actually I want to restrict the table space size and I have used below commands to create database & associate tablespace & tables.

db2 "CREATE DATABASE mydb ON /home/pooji/db2/dbpath1, /home/pooji/db2/dbpath2"

db2 "CREATE TABLESPACE TSPC1 MANAGED BY DATABASE USING (FILE 'home/pooji/db2/tspc1file' 2 M) AUTORESIZE YES INCREASESIZE 2 M MAXSIZE 4 M NO FILE SYSTEM CACHING DROPPED TABLE RECOVERY OFF"

db2 "CREATE TABLE DEPARTMENT ( DEPTNO CHAR(3) NOT NULL, DEPTNAME VARCHAR(36) NOT NULL, PRIMARY KEY (DEPTNO) )" IN TSPC1 INDEX IN TSPC1"

Used "db2 list tablespaces show detail" to get the used pages count before and after mass inserts into department table; The page count remains same. Any problem in above declarations ?
Reply With Quote
  #2 (permalink)  
Old 03-30-11, 04:47
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Do you have the output showing the freepages before and after the mass inserts ?
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 03-30-11, 04:57
poojithas poojithas is offline
Registered User
 
Join Date: Oct 2010
Posts: 4
BEFORE
=========================================
Tablespace ID = 34
Name = TSTEST1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 512
Useable pages = 480
Used pages = 160
Free pages = 320
High water mark (pages) = 160
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1

AFTER
============================================
Tablespace ID = 34
Name = TSTEST1
Type = Database managed space
Contents = All permanent data. Large table space.
State = 0x0000
Detailed explanation:
Normal
Total pages = 512
Useable pages = 480
Used pages = 160
Free pages = 320
High water mark (pages) = 160
Page size (bytes) = 4096
Extent size (pages) = 32
Prefetch size (pages) = 32
Number of containers = 1
Reply With Quote
  #4 (permalink)  
Old 03-30-11, 05:35
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 294
Hi,

Quote:
Originally Posted by poojithas View Post
db2 "CREATE TABLE DEPARTMENT ( DEPTNO CHAR(3) NOT NULL, DEPTNAME VARCHAR(36) NOT NULL, PRIMARY KEY (DEPTNO) )" IN TSPC1 INDEX IN TSPC1"
Is quotation mark a typo in your post? Have you the checked the tablespace for your table department?
db2 "select tbspace, index_tbspace from syscat.tables where tabname='DEPARTMENT'"
Maybe you where checking the wrong tablespace.
What dou you mean by "lots of data rows"? 10, 1000 or 1000000 Rows?
Reply With Quote
  #5 (permalink)  
Old 03-30-11, 05:56
poojithas poojithas is offline
Registered User
 
Join Date: Oct 2010
Posts: 4
Yeah! its a typo.

Inserted around 2500 rows

The table space name is showing correct one.

Last edited by poojithas; 03-30-11 at 06:02.
Reply With Quote
  #6 (permalink)  
Old 03-30-11, 06:12
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by poojithas View Post
Inserted around 2500 rows
A lot of rows? Mass insert?
Try some more, and I mean more more.
Reply With Quote
  #7 (permalink)  
Old 03-30-11, 06:53
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Insert the 2500 rows many times and you should see your tablespace hit the limit
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #8 (permalink)  
Old 03-30-11, 07:03
poojithas poojithas is offline
Registered User
 
Join Date: Oct 2010
Posts: 4
Finally, after 5000 rows insertion, used pages changed to 224

What I understood from this:
When a table is created in a tablespace; db2 allocates few pages for data. Once these initial pages consumed, it uses more.

Thanks, Solved the problem.
Reply With Quote
  #9 (permalink)  
Old 03-30-11, 10:39
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
DB2 allocates multiple pages together, which is called an "extend". Also, DB2 reuses space of deleted rows.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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