@@ -30,16 +30,10 @@ DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
30
30
31
31
<para>
32
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.
33
+ database session. This command is useful for partially or fully
34
+ resetting the session's state. There are several subcommands to
35
+ release different types of resources; the <command>DISCARD ALL</>
36
+ variant subsumes all the others, and also resets additional state.
43
37
</para>
44
38
</refsect1>
45
39
@@ -49,28 +43,34 @@ DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
49
43
<variablelist>
50
44
51
45
<varlistentry>
52
- <term><literal>TEMPORARY</literal> or <literal>TEMP </literal></term>
46
+ <term><literal>PLANS </literal></term>
53
47
<listitem>
54
48
<para>
55
- Drops all temporary tables created in the current session.
49
+ Releases all cached query plans, forcing re-planning to occur
50
+ the next time the associated prepared statement is used.
56
51
</para>
57
52
</listitem>
58
53
</varlistentry>
59
54
60
55
<varlistentry>
61
- <term><literal>PLANS </literal></term>
56
+ <term><literal>SEQUENCES </literal></term>
62
57
<listitem>
63
58
<para>
64
- Releases all cached query plans.
59
+ Discards all cached sequence-related state,
60
+ including <function>currval()</>/<function>lastval()</>
61
+ information and any preallocated sequence values that have not
62
+ yet been returned by <function>nextval()</>.
63
+ (See <xref linkend="sql-createsequence"> for a description of
64
+ preallocated sequence values.)
65
65
</para>
66
66
</listitem>
67
67
</varlistentry>
68
68
69
69
<varlistentry>
70
- <term><literal>SEQUENCES </literal></term>
70
+ <term><literal>TEMPORARY</literal> or <literal>TEMP </literal></term>
71
71
<listitem>
72
72
<para>
73
- Discards all cached sequence values .
73
+ Drops all temporary tables created in the current session .
74
74
</para>
75
75
</listitem>
76
76
</varlistentry>
@@ -91,8 +91,8 @@ CLOSE ALL;
91
91
UNLISTEN *;
92
92
SELECT pg_advisory_unlock_all();
93
93
DISCARD PLANS;
94
- DISCARD TEMP;
95
94
DISCARD SEQUENCES;
95
+ DISCARD TEMP;
96
96
</programlisting></para>
97
97
</listitem>
98
98
</varlistentry>
0 commit comments