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 > Reorg Table - how about PK?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-04, 16:37
dollar489 dollar489 is offline
Registered User
 
Join Date: Sep 2002
Posts: 456
Reorg Table - how about PK?

DB2 V7 FP6 on AIX 4.3.3

If I reorg a table with:

db2 reorg table mytable index myindex use tbsz;

will it also reorg the index myindex? Or just reorg the table data in the order of index myindex?

If the statement above will not reorg the index, then how about these steps:
1. Drop myindex
2. Recreate myindex
3. Reorg table mytable with index myindex

Now, I should have table data in the same order as index....!

Any comment?

Paul
Reply With Quote
  #2 (permalink)  
Old 12-02-04, 23:27
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
In version 7, the indexes will be reorged along with the table. In version 8, there is a separate command to reorg indexes.

When you chose an index to reorg the tables with, DB2 uses the index columns to order the table rows. If you PK has only one column, then that is "probably" the wrong sequence to order the table rows (assuming that you have other indexes on the table).

Generally speaking, one index should be defined as the clustering index, so that inserts will maintain (if possible) the correct sequence of the data, in addition to when you do a reorg of the table.
__________________
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
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