Syntax

DROP [ONLINE|OFFLINE] INDEX [IF EXISTS] index_name ON tbl_name 
  [WAIT n |NOWAIT]

Description

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.

If another connection is using the table, a metadata lock is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.

See ALTER TABLE.

Another shortcut, CREATE INDEX, allows the creation of an index.

To remove the primary key, `PRIMARY` must be specified as index_name. Note that the quotes are necessary, because PRIMARY is a keyword.

IF EXISTS

MariaDB starting with 10.1.4

The IF EXISTS clause was added in MariaDB 10.1.4

When the IF EXISTS clause is used, MariaDB will return a warning instead of an error if the index does not exist.

ONLINE/OFFLINE

MariaDB starting with 10.0

The ONLINE and OFFLINE clauses have been removed in MariaDB 10.0.

MariaDB starting with 10.3.0

WAIT/NOWAIT

Set the lock wait timeout. See WAIT and NOWAIT.

Progress reporting

MariaDB starting with 5.3

Since MariaDB 5.3 this statement supports progress reporting.

See also

Comments

Comments loading...