How to change a HEAP/MEMORY MySQL table's indexes from HASH to BTREE?
I hav开发者_高级运维e a MySQL table with the HEAP/MEMORY storage type that was converted from MyISAM. The indexes were automatically converted to HASH, but I need them to be BTREE. How do I change them from HASH to BTREE?
Dropping the indexes does work, but this wouldn't work with the PRIMARY KEY without doing this:
ALTER TABLE table DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE (id);
Drop the indexes and recreate them using btree
... they don't contain real data so you lose nothing, and in a heap/memory table it should be a pretty fast operation.
精彩评论