]> begriffs open source - ai-pg/blob - full-docs/txt/sql-dropindex.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-dropindex.txt
1
2 DROP INDEX
3
4    DROP INDEX — remove an index
5
6 Synopsis
7
8 DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
9
10 Description
11
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
15 Parameters
16
17    CONCURRENTLY
18           Drop the index without locking out concurrent selects, inserts,
19           updates, and deletes on the index's table. A normal DROP INDEX
20           acquires an ACCESS EXCLUSIVE lock on the table, blocking other
21           accesses until the index drop can be completed. With this
22           option, the command instead waits until conflicting transactions
23           have completed.
24
25           There are several caveats to be aware of when using this option.
26           Only one index name can be specified, and the CASCADE option is
27           not supported. (Thus, an index that supports a UNIQUE or PRIMARY
28           KEY constraint cannot be dropped this way.) Also, regular DROP
29           INDEX commands can be performed within a transaction block, but
30           DROP INDEX CONCURRENTLY cannot. Lastly, indexes on partitioned
31           tables cannot be dropped using this option.
32
33           For temporary tables, DROP INDEX is always non-concurrent, as no
34           other session can access them, and non-concurrent index drop is
35           cheaper.
36
37    IF EXISTS
38           Do not throw an error if the index does not exist. A notice is
39           issued in this case.
40
41    name
42           The name (optionally schema-qualified) of an index to remove.
43
44    CASCADE
45           Automatically drop objects that depend on the index, and in turn
46           all objects that depend on those objects (see Section 5.15).
47
48    RESTRICT
49           Refuse to drop the index if any objects depend on it. This is
50           the default.
51
52 Examples
53
54    This command will remove the index title_idx:
55 DROP INDEX title_idx;
56
57 Compatibility
58
59    DROP INDEX is a PostgreSQL language extension. There are no provisions
60    for indexes in the SQL standard.
61
62 See Also
63
64    CREATE INDEX