我要评分
获取效率
正确性
完整性
易理解

Setting Whether a SQL Statement Accesses the Secondary Engine for Execution

You can set whether a SQL statement accesses the secondary engine for execution using one of the following methods: Adding hints to rewrite the SQL statement, setting the query cost threshold, or using the allowlist for filtering.

Adding Hints to Rewrite SQL Statements

For an SQL statement, add hints to force the SQL statement to access the secondary engine or not.

  1. Log in to the MySQL service through the MySQL client.
  2. Set whether the SQL statement accesses the secondary engine for execution.
    • Force it to access the secondary engine:
      SELECT /*+ SET_VAR(use_secondary_engine = FORCED) */ ... FROM ...
    • Force it not to access the secondary engine:
      SELECT /*+ SET_VAR(use_secondary_engine = OFF) */ ... FROM ...

Setting the Query Cost Threshold

  1. Log in to the MySQL service through the MySQL client.
  2. Set the query cost threshold.
    set secondary_engine_cost_threshold=cost_threshold;

    For example, in the following SELECT statement, the cost in the statement is 0.35. After secondary_engine_cost_threshold is set to a value less than 0.35 (for example, 0.1), the statement can access KOVAE to be filtered by the allowlist and be executed in KOVAE if it passes the filtering.

    explain format=tree select * from t1;
    +------------------------------------------+
    | EXPLAIN                                  |
    +------------------------------------------+
    | -> Table scan on t1  (cost=0.35 rows=1)  |
    +------------------------------------------+
    1 row in set (0.00 sec)

Allowlist Filtering

Currently, the allowlist cannot be manually configured. For details about the support for SQL statements by KOVAE, see SQL Statement Specifications Supported by KOVAE.