OceanBase Database allows you to set system parameters and variables to manage configurations.
Parameters
System parameters are usually used to control system behaviors at the server level or a higher level during O&M. You can set system parameters for starting OBServer nodes and creating tenants. You can also modify them during the operation of OBServer nodes to adjust system behaviors. For more information about system parameters, see Set parameters.
System variables
System variables are usually bound to user sessions to control session-level SQL behaviors.
You can set global and session-level system variables. After you set a global system variable, the setting does not take effect for the current session but applies to all sessions established later. After you set a session-level system variable, the setting takes effect only for the current session.
For more information about system variables, see Set variables.
Comparison between parameters and system variables
| Comparison item | Parameter | System variable |
|---|---|---|
| Applicable scope | Affects a cluster, tenant, zone, or server. | Affects a tenant globally or at the session level. |
| Effective mode |
|
|
| Modification |
|
Modification can only be performed by using SQL statements. For example:
|
| Persistence | System parameters are persisted into internal tables and configuration files and can be queried from the /home/admin/oceanbase/etc/observer.config.bin and /home/admin/oceanbase/etc/observer.config.bin.history files. |
Only variables at the global level are persisted, while those at the session level are not. |
| Lifecycle | Long. A system parameter remains effective for the entire duration of a process. | Short. A system variable takes effect only after the tenant schema is created. |
| Query method | You can query a system parameter by using the SHOW PARAMETERS statement. For example,obclient> SHOW PARAMETERS LIKE 'schema_history_expire_time'; |
You can query a system variable by using the SHOW [GLOBAL] VARIABLES or SELECT statement. For example:
|