If you’ve ever found yourself deep in a performance tuning or debugging session in YugabyteDB, experimenting with session-level configuration parameters (also known as YSQL GUCs), you might have ended up wondering how to cleanly undo your changes and get back to a clean slate.
That’s where the SQL command RESET ALL
comes into play.
RESET ALL
is a PostgreSQL-compatible SQL command supported in YugabyteDB (YSQL). It resets all runtime configuration parameters that have been changed in the current session back to their default values, without needing to restart your connection.
This includes:
Parameters changed via
SET ...
Parameters passed at session start via environment variables or connection options (to the extent they were session-overridable)
It’s a quick way to undo your session tuning without affecting the global or database-level defaults.
Example:
yugabyte=# SET yb_enable_distinct_pushdown = off;
SET
yugabyte=# SET yb_bnl_batch_size = 2048;
SET
yugabyte=# SET yb_enable_bitmapscan = off;
SET
Now you want to revert all of this and go back to the default session behavior:
yugabyte=# RESET ALL;
RESET
After executing RESET ALL
, all GUCs revert to their defaults as defined in the cluster config (or the database-level config if overridden).
yugabyte=# SELECT name, setting FROM pg_settings WHERE name IN ('yb_enable_distinct_pushdown', 'yb_bnl_batch_size', 'yb_enable_bitmapscan');
name | setting
-----------------------------+---------
yb_bnl_batch_size | 1024
yb_enable_bitmapscan | on
yb_enable_distinct_pushdown | on
(3 rows)
Notes:
- It won’t reset server-level or database-level configuration changes made via ALTER DATABASE.
- It also won’t reset changes made in other sessions or by the postgresql.conf (set via the ysql_pg_conf_csv gFlag).
- It won’t reset non-GUC session state, such as temp tables or user-defined variables.
Whether you’re tuning performance, troubleshooting an issue, or just experimenting with different behavior, RESET ALL
is a valuable tool in your YSQL toolbox. Use it to keep your sessions clean, reproducible, and easy to debug.
Have Fun!