Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002

    Unanswered: 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?


  2. #2
    Join Date
    May 2003
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts