Set a GUC (Grand Unified Configuration) Parameter to its Default Value

In YugabyteDB, GUC stands for Grand Unified Configuration.

These are configuration parameters that control various aspects of the database system, such as performance tuning, memory usage, logging, replication, and more.

They are essentially settings that influence how the database operates at both the global and session levels.

GUC parameters are used to configure the behavior of YugabyteDB across different layers, such as:

  1. System-level configurations: Parameters that apply to the whole cluster or node.
  2. Session-level configurations: Parameters that can be set per user session, allowing for fine-grained control over behavior.

Example:

				
					yugabyte=# SHOW yb_follower_read_staleness_ms;
 yb_follower_read_staleness_ms
-------------------------------
 30000
(1 row)

yugabyte=# SET yb_follower_read_staleness_ms = 60000;
SET

yugabyte=# SHOW yb_follower_read_staleness_ms;
 yb_follower_read_staleness_ms
-------------------------------
 60000
(1 row)
				
			

After completing the task for which you modified the parameter, you may want to reset it to its default value.

But what if you forgot the default value?

You can find the default value in the pg_settings system table and use it in the SET command, like this:

				
					yugabyte=# SELECT reset_val FROM pg_settings WHERE name = 'yb_follower_read_staleness_ms';
 reset_val
-----------
 30000
(1 row)

yugabyte=# SET yb_follower_read_staleness_ms = 30000;
SET
				
			

Luckily there are easier methods to reset a GUC parameter back to the default!

The first method is easy to remember because you can simply set the parameter to default, and the name explains it all!

				
					yugabyte=# SET yb_follower_read_staleness_ms = 60000;
SET

yugabyte=# SET yb_follower_read_staleness_ms = default;
SET

yugabyte=# SHOW yb_follower_read_staleness_ms;
 yb_follower_read_staleness_ms
-------------------------------
 30000
(1 row)
				
			

The second, and arguably the easiet method is to use the RESET command:

				
					yugabyte=# SET yb_follower_read_staleness_ms = 60000;
SET

yugabyte=# RESET yb_follower_read_staleness_ms;
RESET

yugabyte=# SHOW yb_follower_read_staleness_ms;
 yb_follower_read_staleness_ms
-------------------------------
 30000
(1 row)
				
			

Since I’m allergic to typing, I go with the RESET option—it’s like cutting my keyboard workouts in half!

				
					yugabyte=# SELECT LENGTH('SET = default') method_1_key_clicks, LENGTH('RESET ') method_2_key_clicks;
 method_1_key_clicks | method_2_key_clicks
---------------------+---------------------
                  13 |                   6
(1 row)
				
			

Have Fun!

I just got the new Samsung Galaxy S25, and it has this cool Sketch to Image feature that turns my doodles into weirdly creepy masterpieces!