MySQL Forums
Forum List  »  MyISAM

Re: myisamchk sorting records descending
Posted by: James Day
Date: April 27, 2005 01:12AM

Two ways to do this, one which might work, one which will.

Might: ALTER TABLE ... ORDER BY column DESC. Don't know if DESC is supported.

Will work: create a copy of the table and use INSERT ... SELECT FROM first table ORDER BY column. Then rename original table to a new name and the copy to the original name. When you're sure that all is OK, delete the original table.

You can probably speed up the second form by using ALTER TABLE ... DISABLE KEYS on the empty table before copying the data. Then copy and enable the keys. Or you could create the table withotu the keys and add them after copying the data.

Options: ReplyQuote


Subject
Views
Written By
Posted
7031
April 12, 2005 01:19AM
3286
April 26, 2005 12:50AM
Re: myisamchk sorting records descending
3076
April 27, 2005 01:12AM
2997
April 28, 2005 08:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.