gpt4 book ai didi

sql - MariaDB是否支持重命名索引?

转载 作者:行者123 更新时间:2023-12-03 17:17:34 24 4
gpt4 key购买 nike

是否有用于在MariaDB中重命名索引的语法?我知道MySQL 5.7支持该语法,但是MariaDB 10.0(包括MySQL 5.6)是否支持该语法?

最佳答案

我刚刚在MariaDB 10.2.12中尝试了ALTER TABLE thing RENAME INDEX ix_old TO ix_new;,但失败了。

它也没有出现在https://mariadb.com/kb/en/library/alter-table/的文档中

奇怪的是,duckduckgo中显示的这个问题的答案不存在!它说

No, there is no way to rename an index in current versions of MySQL (up to 5.6) or MariaDB (up to 10) or Percona Server (up to 5.6).

You can only drop an index and create a new index of a different name.

As a workaround, you could use pt-online-schema-change to add a new index with the new name and drop the old index by its old name, while allowing continuous read/write access to the original table.

$ pt-online-schema-change --alter "ADD KEY new_idx_name, DROP KEY old_idx_name" \ D=mydatabase,t=mytable

--Bill Karwin



但是,比尔·卡温(Bill Karwin)对问题的编辑仍然存在。嗯,他为什么要删除它?

关于sql - MariaDB是否支持重命名索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19797105/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com