> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-index.md).

# DROP INDEX

## Syntax

```bnf
DROP INDEX [IF EXISTS] index_name ON tbl_name 
    [WAIT n |NOWAIT]
```

## Description

`DROP INDEX` drops the [index](/docs/server/ha-and-performance/optimization-and-tuning/optimization-and-indexes.md) 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](/docs/server/reference/sql-statements/transactions/metadata-locking.md) is active, and this statement will wait until the lock is released. This is also true for non-transactional tables.

See [ALTER TABLE](/docs/server/reference/sql-statements/data-definition/alter/alter-table.md).

Another shortcut, [CREATE INDEX](/docs/server/reference/sql-statements/data-definition/create/create-index.md), allows the creation of an index.

To remove the primary key, `PRIMARY` must be specified as index\_name. Note that [the quotes](/docs/server/reference/sql-structure/sql-language-structure/identifier-qualifiers.md) are necessary, because `PRIMARY` is a keyword.

## Privileges

Executing the `DROP INDEX` statement requires the [INDEX](https://github.com/mariadb-corporation/mariadb-docs/blob/main/server/reference/sql-statements/account-management-sql-commands/grant.md#table-privileges) 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 [InnoDB Online DDL Overview](/docs/server/server-usage/storage-engines/innodb/innodb-online-ddl/innodb-online-ddl-overview.md) for more information on online DDL with [InnoDB](/docs/server/server-usage/storage-engines/innodb.md).

## 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 [WAIT and NOWAIT](/docs/server/reference/sql-statements/transactions/wait-and-nowait.md).

## 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 [mariadb](/docs/server/clients-and-utilities/mariadb-client/mariadb-command-line-client.md) client, then the progress report might look like this::

## See Also

* [Getting Started with Indexes](/docs/server/mariadb-quickstart-guides/mariadb-indexes-guide.md)
* [CREATE INDEX](/docs/server/reference/sql-statements/data-definition/create/create-index.md)
* [ALTER TABLE](/docs/server/reference/sql-statements/data-definition/alter/alter-table.md)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
