A detached index is an index with a separate fragmentation strategy that you set up explicitly with the CREATE INDEX statement, as in the following sample SQL statements:
CREATE TABLE tb1 (a int) FRAGMENT BY EXPRESSION (a <= 10) IN tabdbspc1, (a <= 20) IN tabdbspc2, (a <= 30) IN tabdbspc3; CREATE INDEX idx1 ON tb1 (a) FRAGMENT BY EXPRESSION (a <= 10) IN idxdbspc1, (a <= 20) IN idxdbspc2, (a <= 30) IN idxdbspc3;
This example illustrates a common fragmentation strategy, to fragment indexes in the same way as the tables, but specify different dbspaces for the index fragments. This fragmentation strategy of putting the index fragments in different dbspaces from the table can improve the performance of operations such as backup, recovery, and so forth.
By default, all new indexes that the CREATE INDEX statement creates in Dynamic Server are detached and stored in separate tablespaces from the data unless the deprecated IN TABLE syntax is specified.
To create a detached index with partitions, include the partition name in your SQL statements, as shown in this example:
CREATE TABLE tb1 (a int) FRAGMENT BY EXPRESSION PARTITION part1 (a <= 10) IN dbs1, PARTITION part2 (a <= 20) IN dbs2, PARTITION part3 (a <= 30) IN dbs3; CREATE INDEX idx1 ON tb1 (a) FRAGMENT BY EXPRESSION PARTITION part1 (a <= 10) IN dbs1, PARTITION part2 (a <= 20) IN dbs2, PARTITION part3 (a <= 30) IN dbs3;
You can use "PARTITION BY EXPRESSION" instead of "FRAGMENT BY EXPRESSION" in CREATE TABLE, CREATE INDEX, and ALTER FRAGMENT ON INDEX statements.
If you do not want to fragment the index, you can put the entire index in a separate dbspace.
You can fragment the index for any table by expression. However, you cannot explicitly create a round-robin fragmentation scheme for an index. Whenever you fragment a table using a round-robin fragmentation scheme, it is recommended that you convert all indexes that accompany the table to detached indexes for the best performance.
Detached indexes have the following physical characteristics:
The database server stores the location of each table and index fragment, along with other related information, in the system catalog table sysfragments. You can use the sysfragments system catalog table to access the following information about fragmented tables and indexes:
For a complete description of field values that this sysfragments system catalog table contains, see the IBM Informix: Guide to SQL Reference. For information on how to use sysfragments to monitor your fragments, see Monitoring Fragment Use.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]