Reference: Discard Statement

Discard allows resetting the current database session.

Usage example:

-- Reset the complete session state, allowing connection re-use
discard all;

Options

  • all Discard all session state. This includes prepared statements, temporary tables, and session settings. After a discard all, the session behaves like a fresh connection. This is useful when a connection is shared between multiple client threads that all depend on having a pristine connection.
  • plans Discard cached query plans for prepared statements. The prepared statements themselves remain valid. CedarDB automatically re-plans queries periodically, so you should not need to execute this manually.
  • sequences Discard cached sequence state. This currently has no effect.
  • temp, temporary Drop all temporary tables, views, sequences, and functions of the session.

DISCARD ALL cannot run inside a transaction block.

Permissions

DISCARD requires no privileges.