All pages
Powered by GitBook
1 of 1

Loading...

DROP INDEX

Remove an existing index from a table. This command deletes the index structure, potentially impacting query performance but freeing storage.

Syntax

Description

DROP INDEX drops the 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 is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.

See .

Another shortcut, , allows the creation of an index.

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

Privileges

Executing the DROP INDEX statement requires the privilege for the table or the database.

Online DDL

Online DDL is used by default with InnoDB, when the drop index operation supports it.

See for more information on online DDL with .

DROP INDEX IF EXISTS ...

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

WAIT/NOWAIT

Sets the lock wait timeout. See .

Progress Reporting

MariaDB provides progress reporting for DROP INDEX statement for clients that support the new progress reporting protocol. For example, if you were using the client, then the progress report might look like this::

See Also

This page is licensed: GPLv2, originally from

DROP INDEX [IF EXISTS] index_name ON tbl_name 
    [WAIT n |NOWAIT]
index
metadata lock
ALTER TABLE
CREATE INDEX
the quotes
INDEX
InnoDB Online DDL Overview
InnoDB
WAIT and NOWAIT
mariadb
Getting Started with Indexes
CREATE INDEX
ALTER TABLE
fill_help_tables.sql