man > DISCARD(8postfix)

๐Ÿ“› NAME

DISCARD โ€” discard session state

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ”„ Reset all session stateDISCARD ALLReleases all temporary resources and resets session to initial state
๐Ÿ—บ๏ธ Clear cached query plansDISCARD PLANSForces reโ€‘planning for prepared statements
๐Ÿ”ข Reset sequence cachesDISCARD SEQUENCESClears currval/lastval and preallocated sequence values
๐Ÿ—‘๏ธ Drop temporary tablesDISCARD TEMPORARY (or TEMP)Drops all temp tables created in the current session

๐Ÿ“‹ SYNOPSIS

DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }

๐Ÿ“– DESCRIPTION

DISCARD releases internal resources associated with a 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.

โš™๏ธ PARAMETERS

๐Ÿ—บ๏ธ PLANS

Releases all cached query plans, forcing reโ€‘planning to occur the next time the associated prepared statement is used.

๐Ÿ”ข SEQUENCES

Discards all cached sequenceโ€‘related state, including currval()/lastval() information and any preallocated sequence values that have not yet been returned by nextval(). (See CREATE SEQUENCE for a description of preallocated sequence values.)

๐Ÿ—‘๏ธ TEMPORARY or TEMP

Drops all temporary tables created in the current session.

๐Ÿ”„ ALL

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:

CLOSE ALL;
SET SESSION AUTHORIZATION DEFAULT;
RESET ALL;
DEALLOCATE ALL;
UNLISTEN *;
SELECT pg_advisory_unlock_all();
DISCARD PLANS;
DISCARD TEMP;
DISCARD SEQUENCES;

๐Ÿ“ NOTES

DISCARD ALL cannot be executed inside a transaction block.

๐ŸŒ COMPATIBILITY

DISCARD is a PostgreSQL extension.

DISCARD(8postfix)
๐Ÿ“› NAME ๐Ÿš€ Quick Reference ๐Ÿ“‹ SYNOPSIS ๐Ÿ“– DESCRIPTION โš™๏ธ PARAMETERS
๐Ÿ—บ๏ธ PLANS ๐Ÿ”ข SEQUENCES ๐Ÿ—‘๏ธ TEMPORARY or TEMP ๐Ÿ”„ ALL
๐Ÿ“ NOTES ๐ŸŒ COMPATIBILITY

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 01:24 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^