Hi Chris, I don't know exactly what you mean by ALTER being as good as OPTIMIZE...
But yes, an ALTER that recreates the data file (as ALTER ... ORDER BY does) will defragment the data file too. However, OPTIMIZE also analyzes the key distribution (I don't know if it's remembered after an ALTER or not...) and sorts the index pages (but that should be done pretty well I think when the index is rebuilt during ALTER). To summarize, if you just want to reclaim deleted rows, ALTER ... ORDER BY is enough. If you want to make sure everything else is done, use OPTIMIZE too afterwards. :-) Hope that helps. Matt ----- Original Message ----- From: "Chris Elsworth" Sent: Wednesday, December 10, 2003 12:49 PM Subject: ALTER TABLE .. ORDER BY > Hello, > > Just a quickie. Does anyone know if issueing an ALTER TABLE t ORDER BY c > is as good as an OPTIMIZE TABLE if I know the order I'll mostly be > sorting with? Does the ALTER TABLE operation reclaimed deleted rows, > for example? Or should I OPTIMIZE and then ALTER? > > Cheers :) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]