1DROP INDEX(7) PostgreSQL 15.4 Documentation DROP INDEX(7)
2
3
4
6 DROP_INDEX - remove an index
7
9 DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
10
12 DROP INDEX drops an existing index from the database system. To execute
13 this command you must be the owner of the index.
14
16 CONCURRENTLY
17 Drop the index without locking out concurrent selects, inserts,
18 updates, and deletes on the index's table. A normal DROP INDEX
19 acquires an ACCESS EXCLUSIVE lock on the table, blocking other
20 accesses until the index drop can be completed. With this option,
21 the command instead waits until conflicting transactions have
22 completed.
23
24 There are several caveats to be aware of when using this option.
25 Only one index name can be specified, and the CASCADE option is not
26 supported. (Thus, an index that supports a UNIQUE or PRIMARY KEY
27 constraint cannot be dropped this way.) Also, regular DROP INDEX
28 commands can be performed within a transaction block, but DROP
29 INDEX CONCURRENTLY cannot. Lastly, indexes on partitioned tables
30 cannot be dropped using this option.
31
32 For temporary tables, DROP INDEX is always non-concurrent, as no
33 other session can access them, and non-concurrent index drop is
34 cheaper.
35
36 IF EXISTS
37 Do not throw an error if the index does not exist. A notice is
38 issued in this case.
39
40 name
41 The name (optionally schema-qualified) of an index to remove.
42
43 CASCADE
44 Automatically drop objects that depend on the index, and in turn
45 all objects that depend on those objects (see Section 5.14).
46
47 RESTRICT
48 Refuse to drop the index if any objects depend on it. This is the
49 default.
50
52 This command will remove the index title_idx:
53
54 DROP INDEX title_idx;
55
57 DROP INDEX is a PostgreSQL language extension. There are no provisions
58 for indexes in the SQL standard.
59
61 CREATE INDEX (CREATE_INDEX(7))
62
63
64
65PostgreSQL 15.4 2023 DROP INDEX(7)