Updated on 2023-10-23 GMT+08:00

Resetting Parameters

You are advised to modify some parameters on the GaussDB console. If the parameters cannot be modified on the console, evaluate the risks and contact customer service.

Background

GaussDB provides multiple methods to set the GUC parameters of databases, users, or sessions.

  • Parameter names are case-insensitive.
  • A parameter value can be an integer, floating point value, string, Boolean value, or enumerated value.
    • The Boolean values can be on/off, true/false, yes/no, or 1/0, and are case-insensitive.
    • The enumerated value range is specified in the enumvals column of the pg_settings system catalog.
  • For parameters using units, specify their units during the setting. Otherwise, default units are used.
    • The default units are specified in the unit column of pg_settings.
    • The unit of memory can be KB, MB, or GB.
    • The unit of time can be ms, s, min, h, or d.

For details about parameters in the hosts configuration template, see GaussDB.

Setting GUC Parameters

GaussDB provides six types of GUC parameters. For details about parameter types and their setting methods, see Table 1.

Table 1 GUC parameters

Category

Description

How to Set

INTERNAL

Fixed parameter. It is set during database creation and cannot be modified. Users can only view the parameter by running the SHOW command or in the pg_settings view.

None

POSTMASTER

Database server parameter. It can be set when the database is started or in the configuration file.

Method 1 in Table 2.

SIGHUP

Global database parameter. It can be set when the database is started or be modified later.

Method 1, 2, in Table 2.

BACKEND

Session connection parameter. It is specified during session connection creation and cannot be modified after that. The parameter setting becomes invalid when the session is disconnected. This is an internal parameter and not recommended for users to set it.

Method 1, 2, in Table 2.

NOTE:

The parameter setting takes effect when the next session is created.

SUSET

Database administrator parameter. It can be set by common users when or after the database is started. It can also be set by database administrators using SQL statements.

Method 1 or 2 by a common user, or method 3 by a database administrator in Table 2.

USERSET

Common user parameter. It can be set by any user at any time.

Method 1, 2, or 3 in Table 2.

You can set GUC parameters in GaussDB using the three methods listed in Table 2.
Table 2 Methods for setting GUC parameters

No.

How to Set

Method 1

  1. Log in to the management console.
  2. On the Instances page, click the instance name to go to the Basic Information page.
  3. In the navigation pane on the left, click Parameters. On the displayed page, modify parameters.

    If the parameters cannot be modified on the console, evaluate the risks in advance and contact customer service for modification.

  4. Restart the database to make the setting take effect.
    NOTE:

    Rebooting instances will interrupt user operations. Plan a proper execution window before the restart.

Method 2

  1. Log in to the management console.
  2. On the Instances page, click the instance name to go to the Basic Information page.
  3. In the navigation pane on the left, click Parameters. On the displayed page, modify parameters.

    If the parameters cannot be modified on the console, evaluate the risks in advance and contact customer service for modification.

Method 3:

Set parameters at specific database, user, and session levels.

  • Set a database-level parameter.
    1
    openGauss=# ALTER DATABASE dbname SET paraname TO value;
    

    The setting takes effect in the next session.

  • Set a user-level parameter.
    1
    openGauss=# ALTER USER username SET paraname TO value;
    

    The setting takes effect in the next session.

  • Set a session-level parameter.
    1
    openGauss=# SET paraname TO value;
    

    Parameter value in the current session is changed. After you exit the session, the setting becomes invalid.

    NOTE:

    Session-level parameters set by SET have the highest priority, followed by parameters set by ALTER. Parameter values set by ALTER DATABASE have a higher priority than those set using ALTER USER. Priorities of the first three methods are all higher than those of gs_guc.

If you use method 1 or 2 to set a parameter that does not belong to the current environment, the database displays a message indicating that the parameter is not supported.