开发者

How to change a HEAP/MEMORY MySQL table's indexes from HASH to BTREE?

开发者 https://www.devze.com 2023-02-02 11:14 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号