DROP INDEX

A DDL command for removing an index

DROP INDEX is a DDL command for removing an index.

DROP INDEX has always been present in PostgreSQL.

Change history

Examples

Basic DROP INDEX execution:

postgres=# DROP INDEX ocr_uripart_ix;
DROP INDEX

Safely attempting to drop an index which might not exist:

postgres=# DROP INDEX IF EXISTS foo;
NOTICE:  index "foo" does not exist, skipping
DROP INDEX

Attempting to drop an index associated with a constraint:

postgres=# DROP INDEX category_pkey;
ERROR:  cannot drop index category_pkey because constraint category_pkey on table category requires it
HINT:  You can drop constraint category_pkey on table category instead.

Categories

DDL, Indexing

See also

ALTER INDEX, CREATE INDEX