MySQL - rearrange the order of the indexes in a table?
is it possible to rearrange the indexes in a MySQL table ? I have a big table with about 20 indexes on it, but as I created them in the course of a few years, they're not logically ordered anymore. I would like them to have the same order as the columns in the table. I use Navicat, but I don't see an option to move an index up or down in the list. Is it even possible?
UPDATE: I just found out that in Postgresql can't even change the order of columns, let alone indexes ! And to all those people that say I have to use views, and that the columns order is not important : of course it is! Columns and indexes should be logically ordered in the design interfa开发者_StackOverflow中文版ce. Most people use GUI's nowadays to edit their tables!
I just can't believe something basic like this is not implemented. It's 2011, guys !
It's not possible to change the list order of indexes. It may not matter internally within MySQL, but if you did want to change the order, the only way is to drop and re-create them as required.
Having so many indexes may, as @btilly says, might not be the best idea. I don't know what data you have, or the data access patterns that would require indexed access, but it does sound a lot. OTOH, it might just be exactly right. Only someone with access to the DB and that has profiled it would know.
精彩评论