Removes a previously created index. The underlying table and its data are not affected.
Syntax
DROP INDEX [IF EXISTS] [schema_name.]index_name;
Parameters
| Parameter | Description |
|---|
IF EXISTS | Prevents an error if the index does not exist. The statement is a no-op when the index is absent. |
schema_name | The name of the attached database containing the index. Defaults to the main database if omitted. |
index_name | The name of the index to drop. |
Description
DROP INDEX removes a previously created index. After the index is dropped, the query planner can no longer use it to optimize queries. The table data is unchanged.
Behavior
- Only explicitly created indexes can be dropped. Indexes automatically created for
PRIMARY KEY and UNIQUE constraints cannot be dropped directly — drop the table or use ALTER TABLE instead.
- Dropping an index may degrade query performance for queries that relied on it, but does not affect correctness.
DROP INDEX is disabled by default in Turso. It is a partial/experimental feature that must be explicitly enabled before use.
Examples
Drop an index
DROP INDEX idx_users_email;
Drop an index only if it exists
DROP INDEX IF EXISTS idx_old_search;
Drop an index in an attached database
DROP INDEX aux.idx_sessions_token;
See also