The clustering property of an index can be added or removed at any time using SQL statements. Any primary key index, foreign key index, UNIQUE constraint index, or secondary index can be declared with the CLUSTERED property. However, you may declare at most one clustered index per table. You can do this using any of the following statements:
Several statements work in conjunction with each other to allow you to maintain and restore the clustering effect:
The UNLOAD TABLE statement allows you to unload a table in the order of the clustered index key. See UNLOAD statement.
The LOAD TABLE statement inserts rows into the table in the order of the clustered index key. See LOAD TABLE statement.
The INSERT statement attempts to put new rows on the same table page as the one containing adjacent rows, as per the clustered index key. See INSERT statement.
The REORGANIZE TABLE statement restores the clustering of a table by rearranging the rows according to the clustered index. If REORGANIZE TABLE is used with tables where clustering is not specified, the tables are reordered using the primary key. See REORGANIZE TABLE statement.
Discuss this page in DocCommentXchange.
|Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0|