文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

15.1.27 DROP INDEX 语句15.1.27 DROP INDEX Statement

DROP INDEX index_name ON tbl_name
    [algorithm_option | lock_option] ...

algorithm_option:
    ALGORITHM [=] {DEFAULT | INPLACE | COPY}

lock_option:
    LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}

DROP INDEX的索引index_name。此语句映射为一个tbl_name语句来删除索引。参见ALTER TABLE第 15.1.9 节,“ALTER TABLE 语句”此语句删除名为.DROP INDEX drops the index named index_name from the table tbl_name. This statement is mapped to an ALTER TABLE statement to drop the index. See Section 15.1.9, “ALTER TABLE Statement”.

要丢弃主键,索引名始终为 PRIMARY必须以引号标识符指定,因为 PRIMARY 是保留词:To drop a primary key, the index name is always PRIMARY, which must be specified as a quoted identifier because PRIMARY is a reserved word:

DROP INDEX `PRIMARY` ON t;

Indexes on variable width columns of the variable-width columns NDB 表被丢弃在线;即不进行任何表复制。该表不被其他 NDB 集群 API 节点锁定,但在操作期间,同一 API 节点的其他操作被锁定。服务器在确定可行时会自动执行;无需使用任何特殊 SQL 语法或服务器选项即可实现。Indexes on variable-width columns of NDB tables are dropped online; that is, without any table copying. The table is not locked against access from other NDB Cluster API nodes, although it is locked against other operations on the same API node for the duration of the operation. This is done automatically by the server whenever it determines that it is possible to do so; you do not have to use any special SQL syntax or server options to cause it to happen.

ALGORITHM 和 LOCK 子句可用于影响表复制方法以及在修改其索引时对表进行读写的并发级别。它们的含义与 ALTER TABLE 语句相同。更多信息,请参见 第 15.1.9 节,“ALTER TABLE 语句”ALGORITHM and LOCK clauses may be given to influence the table copying method and level of concurrency for reading and writing the table while its indexes are being modified. They have the same meaning as for the ALTER TABLE statement. For more information, see Section 15.1.9, “ALTER TABLE Statement”

MySQL NDB 集群支持使用标准 MySQL 服务器支持的相同 ALGORITHM=INPLACE 语法的在线操作。更多信息请参见 第 25.6.12 节,“带 ALTER TABLE 的在线操作在 NDB 集群MySQL NDB Cluster supports online operations using the same ALGORITHM=INPLACE syntax supported in the standard MySQL Server. See Section 25.6.12, “Online Operations with ALTER TABLE in NDB Cluster”, for more information.