Skip to main content

View system variables

You can set system variables to make seekdb behave as required by your business. This topic describes how to view system variables.

View system variables by using SHOW statements

  1. Log in to seekdb.

    The following example shows how to connect to the database. Replace the placeholder with the actual values in your environment.

    mysql -h127.xx.xx.xx -P2881 -uroot -p***** -A
  2. Query the system variable information by using SHOW statements.

    The syntax is as follows:

    SHOW [SESSION | GLOBAL] VARIABLES [LIKE 'pattern' | WHERE expr]

    The parameters are described as follows:

    • SESSION | GLOBAL: SESSION indicates a session variable, and GLOBAL indicates a global variable. If you do not specify this parameter, the session variables are displayed by default.
    • pattern: the keyword of the variable.

    Here are some examples:

    • Query the session variable ob_query_timeout.

      SHOW VARIABLES LIKE 'ob_query_timeout';

      or

      SHOW SESSION VARIABLES LIKE 'ob_query_timeout';

      The query result is as follows:

      +------------------+-------------+
      | Variable_name | Value |
      +------------------+-------------+
      | ob_query_timeout | 10000000 |
      +------------------+-------------+
      1 row in set
    • Query the global variable ob_query_timeout.

      SHOW GLOBAL VARIABLES WHERE variable_name LIKE 'ob_query_timeout';

      The query result is as follows:

      +------------------+-------------+
      | Variable_name | Value |
      +------------------+-------------+
      | ob_query_timeout | 10000000 |
      +------------------+-------------+
      1 row in set

View system variables by using views

  1. Log in to seekdb.

    The following example shows how to connect to the database. Replace the placeholder with the actual values in your environment.

    mysql -h127.xx.xx.xx -P2881 -uroot -p***** -A
  2. Switch to the oceanbase database.

    USE oceanbase;
  3. Query the variable value by using a view.

    • Query the session variable ob_query_timeout from the INFORMATION_SCHEMA.SESSION_VARIABLES view.

      SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME = 'ob_query_timeout';

      The query result is as follows:

      +------------------+----------------+
      | VARIABLE_NAME | VARIABLE_VALUE |
      +------------------+----------------+
      | ob_query_timeout | 10000000 |
      +------------------+----------------+
      1 row in set
    • Query the global variable ob_query_timeout from the INFORMATION_SCHEMA.GLOBAL_VARIABLES view.

      SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'ob_query_timeout';

      The query result is as follows:

      +------------------+----------------+
      | VARIABLE_NAME | VARIABLE_VALUE |
      +------------------+----------------+
      | ob_query_timeout | 10000000 |
      +------------------+----------------+
      1 row in set
    • Query the modification status and default value of the ob_query_timeout variable from the DBA_OB_SYS_VARIABLES view.

      SELECT * FROM oceanbase.DBA_OB_SYS_VARIABLES WHERE NAME='ob_query_timeout';

      The query result is as follows:

      +----------------------------+----------------------------+------------------+----------+-----------+-----------+------------------+----------------------------------+---------------+-----------+
      | CREATE_TIME | MODIFY_TIME | NAME | VALUE | MIN_VALUE | MAX_VALUE | SCOPE | INFO | DEFAULT_VALUE | ISDEFAULT |
      +----------------------------+----------------------------+------------------+----------+-----------+-----------+------------------+----------------------------------+---------------+-----------+
      | 2025-11-19 16:55:28.311760 | 2025-11-19 16:55:28.311760 | ob_query_timeout | 10000000 | | | GLOBAL | SESSION | Query timeout in microsecond(us) | 10000000 | YES |
      +----------------------------+----------------------------+------------------+----------+-----------+-----------+------------------+----------------------------------+---------------+-----------+
      1 row in set

References