the ORDER BY clause to match the index, and which is much faster for
unordered data. You then drop the old table, use
ALTER TABLE...RENAME
- to rename temp to the old name, and
- recreate
any indexes. The only problem is that
OIDs
+ to rename newtable to the old name, and
+ recreate
the table's indexes. The only problem is that
OIDs
will not be preserved. From then on, CLUSTER should be
fast because most of the heap data has already been
ordered, and the existing index is used.