Skip to main content

System variables

The system variables of OceanBase Database are divided into global variables and session variables. You can set system variables to meet business requirements.

  • Global variables: Global variables are modified at the global level. All users of OceanBase Database share global variables. The modification of global variables does not take effect after the session ends. In addition, the modification of global variables does not take effect on sessions that are already open. You must reestablish a session for the modification to take effect.
  • Session variables: Session variables are modified at the session level. When a client connects to OceanBase Database, OceanBase Database automatically generates session variables by copying global variables. The modification of session variables takes effect only on the current session.

The following table describes the differences between system variables and system parameters.

ItemSystem parameterSystem variable
ScopeInstanceGlobal or session
Effective method
  • Dynamic effective: edit_level is dynamic_effective
  • Effective after restart: edit_level is static_effective
  • Setting a session-level variable takes effect only on the current session.
  • Setting a global-level variable takes effect only after you log in and establish a new session.
Modification method
  • You can modify a system parameter by using an SQL statement. Example: Alter SYSTEM SET schema_history_expire_time='1h';
  • You can modify a system parameter by using a startup parameter. Example: /usr/bin/observer --base-dir /var/lib/oceanbase-lite --schema_history_expire_time=1h;
You can modify a system variable by using an SQL statement. Example: SET ob_query_timeout = 20000000; or SET GLOBAL ob_query_timeout = 20000000;
Query methodYou can execute the SHOW PARAMETERS statement to query system parameters. Example: SHOW PARAMETERS LIKE 'schema_history_expire_time';You can execute the SHOW [GLOBAL] VARIABLES statement to query system variables. Example: SHOW VARIABLES LIKE 'ob_query_timeout'; or SHOW GLOBAL VARIABLES LIKE 'ob_query_timeout';
LifetimeLong: from the time when the process starts to the time when it exits.Short: takes effect only after a schema is created.

References