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 > db2 9.7 Reorg Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-20-11, 12:10
dgunas dgunas is offline
Registered User
 
Join Date: Dec 2008
Location: Chennai
Posts: 110
db2 9.7 Reorg Table

Hi
DB2 9.7, FP 3a/ Win 2008 R2

I have a LARGE type tablespace and contain couple of big tables with around 80 million rows. Each has around 6 indexes in different tablespace (LARGE type).
I am going to do the offline REORG for this tables and want to use the temporary tablespace (USERTEMP).

### REORG TABLE XYZ USE USERTEMP;

Also I am lookig to recover some space back as the current HWM is too high.

My question is,
1. Does the USERTEMP tablespace must be LARGE type TBS?
2. Will this rebuild the indexes too?

Please advise
Thanks, valan.
__________________
Reply With Quote
  #2 (permalink)  
Old 09-20-11, 12:59
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
From the syntax diagram for CREATE TABLESPACE, you cannot create a "LARGE" SYSTEM TEMPORARY tablespace. You do need one that is the same pagesize of the tablespace that the table resides in. It will not reorg your indexes at the same time. You need to reorg those separately. It does rebuild the indexes in the sense that the pointers to the rows get changed to the new layout of the table data.

Andy
Reply With Quote
  #3 (permalink)  
Old 09-20-11, 14:24
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
I believe that an offline reorg of a table will automatically rebuild (reorg) all the indexes also.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 09-20-11, 16:49
dgunas dgunas is offline
Registered User
 
Join Date: Dec 2008
Location: Chennai
Posts: 110
reorg

My LARGE TBS page size is 4K. The table size is around 40GB, Indexes also smilar size.
If I use the TEMPSPACE (4k page), will the table and indexes will fit in this TBS? (4K page TSB size limit is 64GB)


Thanks.
__________________
Reply With Quote
  #5 (permalink)  
Old 09-21-11, 04:12
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by Marcus_A View Post
I believe that an offline reorg of a table will automatically rebuild (reorg) all the indexes also.
You believe, I'm sure

What I am not sure of, but would be nice to test in this case:
drop the 4k usertemp
create a 32k usertemp (I assume there are NO 8 & 16k usertemps).
Now when you do your REORG it will use the 32K tempspace which can be much larger.

Hmmmmm... suppose this works... Why the *beeb* do we need 4, 8 & 16k temp-tablespaces???? Maybe we never "needed" them but just created them out of a habit
Reply With Quote
  #6 (permalink)  
Old 09-21-11, 04:49
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
the problem is that if this 4K_temp is the only with 4K size pages - you can not drop it
if both exist (4K-32K)- you can not force usage of one or another
we have the same problem with a table in 32K ts - and join/order/group is using 4K temp and hitting max limit - (see older post) - not easy to force the usage of this 32K temp
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #7 (permalink)  
Old 09-21-11, 09:45
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by przytula_guy View Post
the problem is that if this 4K_temp is the only with 4K size pages - you can not drop it
if both exist (4K-32K)- you can not force usage of one or another
we have the same problem with a table in 32K ts - and join/order/group is using 4K temp and hitting max limit - (see older post) - not easy to force the usage of this 32K temp
This is true for a query, but not for a reorg--which is what the OP is asking about. If you specify a System Temporary Tablespace on the reorg command, it will use the one you requested (if it is the same pagesize as that of the table).


Quote:
My LARGE TBS page size is 4K. The table size is around 40GB, Indexes also smilar size.
If I use the TEMPSPACE (4k page), will the table and indexes will fit in this TBS? (4K page TSB size limit is 64GB)
The limits for the table and indexes are separate. You can have table and indexes that are bigger than 64GB in a 4K tablespace. The table alone cannot exceed 64GB. The index size is either 64GB or 2048GB depending on the tablespace type (DMS/SMS).

Andy
Reply With Quote
  #8 (permalink)  
Old 09-21-11, 13:16
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
tables as large as these should be partitioned.
it will improve your query performance and maintenance time (reorg, runstats).

might be a good idea to place them in separate tablespaces too but it depends...
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #9 (permalink)  
Old 09-21-11, 17:10
dgunas dgunas is offline
Registered User
 
Join Date: Dec 2008
Location: Chennai
Posts: 110
thanks

Thanks for all your suggestions, I will try this on our test system first.

Regards, valan.
__________________
Reply With Quote
  #10 (permalink)  
Old 09-21-11, 18:32
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Quote:
Originally Posted by ARWinner View Post
This is true for a query, but not for a reorg--which is what the OP is asking about. If you specify a System Temporary Tablespace on the reorg command, it will use the one you requested (if it is the same pagesize as that of the table).

Just to add:
Table reorg will use a tempspace specified on the reorg command. If you happen to have two tempspaces of the same page size (not sure why someone would do that but I've seen it) and rebuilding of the indexes require a tempspace due to the spilling of sorts, then it will be chosen in a round robin (just for the index rebuild phase).
Reply With Quote
  #11 (permalink)  
Old 09-22-11, 04:31
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Quote:
Originally Posted by MarkhamDBA View Post
tables as large as these should be partitioned.
it will improve your maintenance time (reorg, runstats).
working/testing with that right now. Not as simple as "presented on the whiteboard".
To really gain REORG time you must define ALL your indexes as partitioned.
When your partitioning column is not part of your PK definition you'll have to make choices:

- The unique PK index remains global. bye bye performance gain because that index has to be rebuilt completely when you do a reorg (on data partition)
- drop the PK constraint and drop the unique-ness of your index. bye bye FK constraints because your table does not have a PK anymore. Works, but not as designed.

But if you manage to convert all your indexes to partitioned the performance gain during "reorg data partition" ís impressive.
Reply With Quote
  #12 (permalink)  
Old 09-22-11, 09:36
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by db2girl View Post
If you happen to have two tempspaces of the same page size (not sure why someone would do that but I've seen it)
A good reason would be to place them on different file systems so that when you reorg a table on one filesystem you can use the temp space on an other filesyatem to speed thing up.

Andy
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