3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
10 .TH "DISCARD" "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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 DISCARD \- discard session state
35 DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
40 releases internal resources associated with a database session\&. This command is useful for partially or fully resetting the session\*(Aqs state\&. There are several subcommands to release different types of resources; the
42 variant subsumes all the others, and also resets additional state\&.
47 Releases all cached query plans, forcing re\-planning to occur the next time the associated prepared statement is used\&.
52 Discards all cached sequence\-related state, including
53 \fBcurrval()\fR/\fBlastval()\fR
54 information and any preallocated sequence values that have not yet been returned by
55 \fBnextval()\fR\&. (See
56 CREATE SEQUENCE (\fBCREATE_SEQUENCE\fR(7))
57 for a description of preallocated sequence values\&.)
62 Drops all temporary tables created in the current session\&.
67 Releases all temporary resources associated with the current session and resets the session to its initial state\&. Currently, this has the same effect as executing the following sequence of statements:
74 SET SESSION AUTHORIZATION DEFAULT;
78 SELECT pg_advisory_unlock_all();
90 cannot be executed inside a transaction block\&.