DISCARD> releases internal resources associated with a
- database session. These resources are normally released at the end
- of the session.
-
-
- DISCARD TEMP> drops all temporary tables created in the
- current session. DISCARD PLANS> releases all internally
- cached query plans. DISCARD ALL> resets a session to
- its original state, discarding temporary resources and resetting
- session-local configuration changes.
+ database session. This command is useful for partially or fully
+ resetting the session's state. There are several subcommands to
+ release different types of resources; the DISCARD ALL>
+ variant subsumes all the others, and also resets additional state.
- TEMPORARY or TEMP
+ PLANS
- Drops all temporary tables created in the current session.
+ Releases all cached query plans, forcing re-planning to occur
+ the next time the associated prepared statement is used.
- PLANS
+ SEQUENCES
- Releases all cached query plans.
+ Discards all cached sequence-related state,
+ including currval()>/lastval()>
+ information and any preallocated sequence values that have not
+ yet been returned by nextval()>.
+ (See for a description of
+ preallocated sequence values.)
- SEQUENCES
+ TEMPORARY or TEMP
- Discards all cached sequence values.
+ Drops all temporary tables created in the current session.
UNLISTEN *;
SELECT pg_advisory_unlock_all();
DISCARD PLANS;
-DISCARD TEMP;
DISCARD SEQUENCES;
+DISCARD TEMP;