SQL Keywords

SQL RESET

What is the SQL RESET command in PostgreSQL?

Returns run-time configuration parameters to their default values for the current session.
Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Compatible dialects for SQL RESET: PostgreSQL (full support); Amazon Redshift (partial, limited parameters); YugabyteDB (PostgreSQL compatible). Not supported in MySQL, SQL Server, Oracle, SQLite.

SQL RESET Full Explanation

RESET is a session-level command, primarily available in PostgreSQL, that clears a previously changed run-time parameter and restores the server’s built-in default (or the value defined in postgresql.conf). It affects only the current database connection and does not persist after the session ends. RESET ALL reverts every modifiable setting, while RESET parameter_name targets a single variable. Because it is transactional, a RESET issued inside a transaction block can be rolled back. When a RESET takes effect, the server re-computes dependent caches (e.g., planner settings). The command requires no special privileges unless the parameter itself is superuser-only.

SQL RESET Syntax

RESET configuration_parameter;
RESET ALL;

SQL RESET Parameters

  • ALL - Keyword that instructs PostgreSQL to reset every configurable parameter.

Example Queries Using SQL RESET

-- Revert work_mem back to its default for this session
RESET work_mem;

-- Undo all session-level SET commands in one go
RESET ALL;

-- Transactional example
BEGIN;
SET search_path = reporting, public;
RESET search_path;  -- returns to default (usually "$user",public)
ROLLBACK;           -- both SET and RESET are rolled back

Expected Output Using SQL RESET

  • The specified parameter, or all parameters, immediately revert to their default values for the current session
  • No rows are returned; the server prints "RESET" as command tag

Use Cases with SQL RESET

  • Clear ad-hoc tuning (e.g., work_mem, enable_nestloop) after testing queries
  • Ensure a connection pool thread starts from a clean slate before reuse
  • Undo temporary locale or time zone changes in interactive sessions
  • Maintain predictable behavior in scripts that conditionally adjust parameters

Common Mistakes with SQL RESET

  • Assuming RESET persists across sessions. It is session-local only.
  • Forgetting that RESET ALL also undoes parameters changed by the client or by extensions.
  • Attempting to RESET parameters marked as PGC_POSTMASTER which require server restart; these raise an error.
  • Using RESET outside PostgreSQL and expecting support in MySQL or SQL Server.

Related Topics

SET, SHOW, ALTER SYSTEM, DISCARD, BEGIN/COMMIT, SESSION variables

First Introduced In

PostgreSQL 7.3

Frequently Asked Questions

What is the difference between RESET and RESET ALL?

RESET targets a single parameter. RESET ALL reverts every modifiable parameter in the session.

Can I undo a RESET inside a transaction?

Yes. Because RESET is transactional, issuing ROLLBACK will undo the RESET and restore the previous parameter value.

Why did my RESET fail with “parameter requires restart”?

Parameters classified as PGC_POSTMASTER can only be changed in postgresql.conf and need a server restart. They cannot be reset at session level.

Does MySQL support RESET like PostgreSQL?

No. MySQL uses RESET for administrative commands (e.g., RESET SLAVE) but has no equivalent of PostgreSQL’s session-parameter RESET.

Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.
Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo

Check out other commonly used SQL Keywords!