Re: Sorting Table
Posted in 1998
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
Prasanna Athawale wrote:
>
> Hi all,
>
> Is there a way to sort a table on a key without unloading the data from the table and store the sorted data back into the same table??, thank U.
Yup:
If you do not now have an index on the sort column(s):
create cluster index indexname on mytable( sort_col1, sort_col2, ...);
If you do have such an index (non-clustered):
alter index indexname to cluster;
If you already have a clustered index but the table has grown:
alter index indexname to not cluster;
alter index indexname to cluster;
Clustering an index causes the table's rows to be stored in physical
order to match the index. Only one cluster index is permitter per
table (think about it).
Art S. Kagel