Tenant system variables

2024-03-05 01:54:26  Updated

This topic introduces tenant system variables in OceanBase Database.

System variable categories

In OceanBase Database, a tenant's system variables fall into two categories: global variables and session variables. These variables allow you to tailor OceanBase's behavior to meet specific service requirements.

  • A global variable enables modifications on a per tenant basis. Users within the same tenant share these global variable settings. Modifications made to global variables persist beyond the current session. Notably, changes to global variables do not immediately impact the ongoing session; they take effect only upon establishing a new session.
  • A session variable enables modifications at the session level. When a client connects to the database, global variable settings are automatically copied to create session-level variables. Changes made to session-level variables are confined to the current session and do not extend beyond it.

Comparison between system parameters and system variables

The following table compares system parameters and system variables.

Item System parameter System variable
Scope of effect Divided into cluster, zone, server, or tenant level. Divided into global or session level within a tenant.
Activation method
  • Dynamic activation: edit_level is dynamic_effective.
  • Restart activation: edit_level is static_effective.
  • Setting session-level variables is effective only for the current session, not for others.
  • Setting global-level variable is ineffective for the current session; a new session is required for the changes to take effect.
Modification method
  • Supports modification through SQL statements, for example:
    Alter SYSTEM SET schema_history_expire_time='1h'
  • Supports modification through startup parameters, for example:
    cd /home/admin/oceanbase && ./bin/observer -o "schema_history_expire_time='1h'";
Only supports modification through SQL statements, for example:
  • MySQL mode
    SET ob_query_timeout = 20000000;
    SET GLOBAL ob_query_timeout = 20000000;
  • Oracle mode
    ALTER SESSION SET ob_query_timeout = 20000000;
    ALTER SYSTEM SET ob_query_timeout = 20000000;
    or
    SET ob_query_timeout = 20000000;
    SET GLOBAL ob_query_timeout = 20000000;
Query method Can be queried through the SHOW PARAMETERS statement, for example: SHOW PARAMETERS LIKE 'schema_history_expire_time';. Can be queried through the SHOW [GLOBAL] VARIABLES statement, for example:
  • MySQL mode
    SHOW VARIABLES LIKE 'ob_query_timeout';
    SHOW GLOBAL VARIABLES LIKE 'ob_query_timeout';
  • Oracle mode
    SELECT * FROM SYS.TENANT_VIRTUAL_SESSION_VARIABLE WHERE VARIABLE_NAME = 'ob_query_timeout';
    SELECT * FROM SYS.TENANT_VIRTUAL_GLOBAL_VARIABLE WHERE VARIABLE_NAME = 'ob_query_timeout';
Persistence Persisted into internal tables and configuration files; can be found in the /home/admin/oceanbase/etc/observer.config.bin and /home/admin/oceanbase/etc/observer.config.bin.history files. Only global-level variables are persisted; session-level variables are not.
Lifecycle Long-lasting, from process startup to exit. Short-lived, effective only after successful creation of the tenant's schema.

References

Contact Us