In OceanBase Database, the system variables of a tenant can be categorized into global variables and session variables. You can set system variables to ensure that the behaviors of OceanBase Database meet the service requirements.
- A global variable is used to implement a global modification. Different users of the same database tenant share the settings of global variables. Modification to global variables remains effective after you exit the session. In addition, modification to a global variable does not take effect on the currently open session and takes effect only for new sessions.
- A session variable is used to implement a session-level modification. When a client is connected to the database, the database copies global variables to automatically generate session-level variables. Modifications made to session-level variables apply to the current session only.
The following table compares the system variables and system parameters.
| Comparison item | System parameters | System variables |
|---|---|---|
| Applicable scope | Affects a cluster, zone, server, or tenant. | Affects a tenant globally or at the session level. |
| Effective mode |
|
|
| Modification |
|
Modification can only be performed by using SQL statements. Example:
|
| Query method | You can query a system parameter by using the SHOW PARAMETERS statement. Example: SHOW PARAMETERS LIKE 'schema_history_expire_time';. |
You can query a variable by using the SHOW [GLOBAL] VARIABLES statement. Examples:
|
| 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 global variables are persisted. |
| 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. |