Skip to main content

DROP INDEX

Use the DROP INDEX command to remove an index from a table or a materialized view.

Syntax

DROP INDEX [ IF EXISTS ] [ schema_name.]index_name [ CASCADE ];

Parameters

ParameterDescription
IF EXISTS clauseDo not return an error if the specified index does not exist.
schema_nameThe schema of the index that you want to remove.
You can use SHOW SCHEMAS to get a list of all available schemas. If you don't specify a schema, the specified index in the default schema public will be removed.
index_nameThe name of the index to remove.
You can use DESCRIBE to show the indexes of a table.
CASCADE optionIf this option is specified, all objects that depend on the index, and in turn all objects that depend on those objects will be dropped.

Examples

This statement removes the id_index index from the taxi_trips table in the default schema (public):

DROP INDEX id_index;

This statement removes the ad_id_index index from the ad_ctr_5min materialized view in the rw_schema schema:

DROP INDEX rw_schema.id_index;

See also

CREATE INDEX — Construct an index on a table or a materialized view to speed up queries.

Ask AI

Help us make this doc better!

Was this page helpful?

Happy React is loading...