DISCARD(7)
π NAME π
okay bestie, welcome to the DISCARD(7) manual page β the one all about discarding session state. DISCARD β discard session state. slay.
β¨ SYNOPSIS β¨
DISCARD { ALL | PLANS | SEQUENCES | TEMPORARY | TEMP }
π DESCRIPTION π
So DISCARD releases internal resources associated with a database session. Itβs useful for partially or fully resetting the sessionβs state, fr fr. There are several subcommands to release different types of resources; the DISCARD ALL variant subsumes all the others, and also resets additional state. main character energy honestly.
πΈ PARAMETERS πΈ
PLANSβ releases all cached query plans, forcing re-planning to occur the next time the associated prepared statement is used. no cap, itβs making the planner think again πSEQUENCESβ discards all cached sequence-related state, includingcurrval()/lastval()information and any preallocated sequence values that have not yet been returned bynextval(). (SeeCREATE SEQUENCE (CREATE_SEQUENCE(7))for a description of preallocated sequence values.) π«ΆTEMPORARYorTEMPβ drops all temporary tables created in the current session. bye bye temp tables π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 π
bestie, important: DISCARD ALL cannot be executed inside a transaction block. not even a little. no cap π
β COMPATIBILITY β
DISCARD is a PostgreSQL extension. periodt.
hope that helped, bestie π this page is from PostgreSQL 13.23 and itβs dated 2025 β mwah π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms