---
title: "DROP INDEX"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_drop_index/"
---

# DROP INDEX

Use the DROP INDEX statement to remove one or more indexes from the database.

## Synopsis

Use the `DROP INDEX` statement to remove an index from the database.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
drop_index ::= DROP INDEX [ IF EXISTS ] index_name 
               [ CASCADE | RESTRICT ]
```

#### drop\_index

DROPINDEXIFEXISTS[index\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#index-name)CASCADERESTRICT

## Semantics

#### *if\_exists*

Under normal operation, an error is raised if the index does not exist. Adding `IF EXISTS` will quietly ignore any non-existent indexes specified.

#### *index\_name*

Specify the name of the index to be dropped. Objects associated with the index will be invalidated after the `DROP INDEX` statement is completed.

#### RESTRICT / CASCADE

`RESTRICT` (the default) will not drop the index if any objects depend on it.

`CASCADE` will drop any objects that transitively depend on the index.

## Example

Create a table with an index:

```plpgsql
CREATE TABLE t1(id BIGSERIAL PRIMARY KEY, v TEXT);
CREATE INDEX i1 ON t1(v);
```

Verify the index was created:

```sql
\d t1
```

```output
                            Table "public.t1"
 Column |  Type  | Collation | Nullable |            Default
--------+--------+-----------+----------+--------------------------------
 id     | bigint |           | not null | nextval('t1_id_seq'::regclass)
 v      | text   |           |          |
Indexes:
    "t1_pkey" PRIMARY KEY, lsm (id HASH)
    "i1" lsm (v HASH)
```

Drop the index:

```sql
DROP INDEX i1;
```

Use the `\d t1` meta-command to verify that the index no longer exists.

```sql
\d t1
```

```output
                            Table "public.t1"
 Column |  Type  | Collation | Nullable |            Default
--------+--------+-----------+----------+--------------------------------
 id     | bigint |           | not null | nextval('t1_id_seq'::regclass)
 v      | text   |           |          |
Indexes:
    "t1_pkey" PRIMARY KEY, lsm (id HASH)
```

## See also

- [CREATE INDEX](/stable/api/ysql/the-sql-language/statements/ddl_create_index "CREATE INDEX")
- [INSERT](/stable/api/ysql/the-sql-language/statements/dml_insert "INSERT")
- [SELECT](/stable/api/ysql/the-sql-language/statements/dml_select/ "SELECT")
