Skip to content

SET

Set the value of a configuration parameter.

SET [ SESSION | LOCAL ] parameter { TO | = } { value | 'value' | DEFAULT }
SESSION
Set the value for the duration of the current session.
LOCAL
Set the value for the duration of the current transaction.

For example:

premdb=# create schema premier;
CREATE SCHEMA
premdb=# create schema league;
CREATE SCHEMA
premdb=# set search_path to premier, league;
SET
premdb=# show search_path;
   search_path   
-----------------
 premier, league
(1 row)

Note: SET SCHEMA 'value' is equivalent to SET search_path TO value, but you can only specify one schema with the SET SCHEMA syntax.

Some parameters cannot be changed at the session or local level. See the SHOW command.

SET application_name

You can use a SET command to set the application_name parameter. For example:

premdb=# set application_name to ybsql_yb100;
SET

Setting the application name is useful for workload management configuration. For example, you can create WLM rules that refer to the application name in a condition.

Parent topic:SQL Commands