]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/discard.sgml
Create a "sort support" interface API for faster sorting.
[postgresql] / doc / src / sgml / ref / discard.sgml
1 <!--
2 doc/src/sgml/ref/discard.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-DISCARD">
7  <refmeta>
8   <refentrytitle>DISCARD</refentrytitle>
9   <manvolnum>7</manvolnum>
10   <refmiscinfo>SQL - Language Statements</refmiscinfo>
11  </refmeta>
12
13  <refnamediv>
14   <refname>DISCARD</refname>
15   <refpurpose>discard session state</refpurpose>
16  </refnamediv>
17
18  <indexterm zone="sql-discard">
19   <primary>DISCARD</primary>
20  </indexterm>
21
22  <refsynopsisdiv>
23 <synopsis>
24 DISCARD { ALL | PLANS | TEMPORARY | TEMP }
25 </synopsis>
26  </refsynopsisdiv>
27
28  <refsect1>
29   <title>Description</title>
30
31   <para>
32    <command>DISCARD</> releases internal resources associated with a
33    database session. These resources are normally released at the end
34    of the session.
35   </para>
36
37   <para>
38    <command>DISCARD TEMP</> drops all temporary tables created in the
39    current session.  <command>DISCARD PLANS</> releases all internally
40    cached query plans.  <command>DISCARD ALL</> resets a session to
41    its original state, discarding temporary resources and resetting
42    session-local configuration changes.
43   </para>
44  </refsect1>
45
46  <refsect1>
47   <title>Parameters</title>
48
49   <variablelist>
50
51    <varlistentry>
52     <term><literal>TEMPORARY</literal> or <literal>TEMP</literal></term>
53     <listitem>
54      <para>
55       Drops all temporary tables created in the current session.
56      </para>
57     </listitem>
58    </varlistentry>
59
60    <varlistentry>
61     <term><literal>PLANS</literal></term>
62     <listitem>
63      <para>
64       Releases all cached query plans.
65      </para>
66     </listitem>
67    </varlistentry>
68
69    <varlistentry>
70     <term><literal>ALL</literal></term>
71     <listitem>
72      <para>
73       Releases all temporary resources associated with the current
74       session and resets the session to its initial state.
75       Currently, this has the same effect as executing the following sequence
76       of statements:
77 <programlisting>
78 SET SESSION AUTHORIZATION DEFAULT;
79 RESET ALL;
80 DEALLOCATE ALL;
81 CLOSE ALL;
82 UNLISTEN *;
83 SELECT pg_advisory_unlock_all();
84 DISCARD PLANS;
85 DISCARD TEMP;
86 </programlisting></para>
87     </listitem>
88    </varlistentry>
89
90   </variablelist>
91  </refsect1>
92
93  <refsect1>
94   <title>Notes</title>
95
96    <para>
97     <command>DISCARD ALL</> cannot be executed inside a transaction block.
98    </para>
99  </refsect1>
100
101  <refsect1>
102   <title>Compatibility</title>
103
104   <para>
105    <command>DISCARD</command> is a <productname>PostgreSQL</productname> extension.
106   </para>
107  </refsect1>
108 </refentry>