Does MySQL's ALTER TABLE ADD PRIMARY KEY also cluster the data, or do I need to create the table from scratch with the primary key to get the clustering?
+1
A:
It depends on the engine. MyISAM doesn't do it, but InnoDB does. If you're using MyISAM you can cluster the table using the ALTER TABLE ORDER BY syntax.
Emil H
2009-07-16 00:04:54