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