]> begriffs open source - ai-pg/blob - full-docs/man7/DROP_INDEX.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DROP_INDEX.7
1 '\" t
2 .\"     Title: DROP INDEX
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROP INDEX" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DROP_INDEX \- remove an index
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP INDEX [ CONCURRENTLY ] [ IF EXISTS ] \fIname\fR [, \&.\&.\&.] [ CASCADE | RESTRICT ]
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBDROP INDEX\fR
40 drops an existing index from the database system\&. To execute this command you must be the owner of the index\&.
41 .SH "PARAMETERS"
42 .PP
43 CONCURRENTLY
44 .RS 4
45 Drop the index without locking out concurrent selects, inserts, updates, and deletes on the index\*(Aqs table\&. A normal
46 \fBDROP INDEX\fR
47 acquires an
48 ACCESS EXCLUSIVE
49 lock on the table, blocking other accesses until the index drop can be completed\&. With this option, the command instead waits until conflicting transactions have completed\&.
50 .sp
51 There are several caveats to be aware of when using this option\&. Only one index name can be specified, and the
52 CASCADE
53 option is not supported\&. (Thus, an index that supports a
54 UNIQUE
55 or
56 PRIMARY KEY
57 constraint cannot be dropped this way\&.) Also, regular
58 \fBDROP INDEX\fR
59 commands can be performed within a transaction block, but
60 \fBDROP INDEX CONCURRENTLY\fR
61 cannot\&. Lastly, indexes on partitioned tables cannot be dropped using this option\&.
62 .sp
63 For temporary tables,
64 \fBDROP INDEX\fR
65 is always non\-concurrent, as no other session can access them, and non\-concurrent index drop is cheaper\&.
66 .RE
67 .PP
68 IF EXISTS
69 .RS 4
70 Do not throw an error if the index does not exist\&. A notice is issued in this case\&.
71 .RE
72 .PP
73 \fIname\fR
74 .RS 4
75 The name (optionally schema\-qualified) of an index to remove\&.
76 .RE
77 .PP
78 CASCADE
79 .RS 4
80 Automatically drop objects that depend on the index, and in turn all objects that depend on those objects (see
81 Section\ \&5.15)\&.
82 .RE
83 .PP
84 RESTRICT
85 .RS 4
86 Refuse to drop the index if any objects depend on it\&. This is the default\&.
87 .RE
88 .SH "EXAMPLES"
89 .PP
90 This command will remove the index
91 title_idx:
92 .sp
93 .if n \{\
94 .RS 4
95 .\}
96 .nf
97 DROP INDEX title_idx;
98 .fi
99 .if n \{\
100 .RE
101 .\}
102 .SH "COMPATIBILITY"
103 .PP
104 \fBDROP INDEX\fR
105 is a
106 PostgreSQL
107 language extension\&. There are no provisions for indexes in the SQL standard\&.
108 .SH "SEE ALSO"
109 CREATE INDEX (\fBCREATE_INDEX\fR(7))