MySQL HeatWave User Guide  /  ...  /  Query Execution Monitoring

6.2.5 Query Execution Monitoring

  • To view the number of queries offloaded to the HeatWave Cluster for execution since the last time HeatWave Cluster was started:

    mysql> SELECT VARIABLE_VALUE
              FROM performance_schema.global_status
              WHERE VARIABLE_NAME = 'rapid_query_offload_count';
    +----------------+
    | VARIABLE_VALUE |
    +----------------+
    | 62             |
    +----------------+
  • As of MySQL 8.0.29, the Performance Schema statement event tables (see Performance Schema Statement Event Tables), and the performance_schema.threads and performance_schema.processlist tables include an EXECUTION_ENGINE column that indicates whether a query was processed on the PRIMARY or SECONDARY engine, where the primary engine is InnoDB and the secondary engine is HeatWave. The sys.processlist and sys.x$processlist views in the MySQL sys Schema also include an execution_engine column.

    This query shows the schema, the first 50 characters of the query, and the execution engine that processed the query:

    mysql> SELECT CURRENT_SCHEMA, LEFT(DIGEST_TEXT, 50), EXECUTION_ENGINE
              FROM performance_schema.events_statements_history
              WHERE CURRENT_SCHEMA='tpch';
    +----------------+----------------------------------------------------+------------------+
    | CURRENT_SCHEMA | LEFT(DIGEST_TEXT, 50)                              | EXECUTION_ENGINE |
    +----------------+----------------------------------------------------+------------------+
    | tpch           | SELECT COUNT(*) FROM tpch.LINEITEM                 | SECONDARY        |
    +----------------+----------------------------------------------------+------------------+
  • As of MySQL 8.0.29, the Performance Schema statement summary tables (see Statement Summary Tables) include a COUNT_SECONDARY column that indicates the number of times a query was processed on the SECONDARY engine (HeatWave).

    This query retrieves the total number of secondary engine execution events from the events_statements_summary_by_digest table:

    mysql> SELECT SUM(COUNT_SECONDARY)
              FROM performance_schema.events_statements_summary_by_digest;
    +----------------------+
    | SUM(COUNT_SECONDARY) |
    +----------------------+
    |                   25 |
    +----------------------+

    This query counts all engine execution events for a particular schema and shows how many occurred on the primary engine (InnoDB) and how many occurred on the secondary engine (HeatWave):

    mysql> SELECT SUM(COUNT_STAR) AS TOTAL_EXECUTIONS, SUM(COUNT_STAR) - SUM(COUNT_SECONDARY)
              AS PRIMARY_ENGINE, SUM(COUNT_SECONDARY) AS SECONDARY_ENGINE
              FROM performance_schema.events_statements_summary_by_digest
              WHERE SCHEMA_NAME LIKE 'tpch';
    *************************** 1. row ***************************
    TOTAL_EXECUTIONS: 25
      PRIMARY_ENGINE: 5
    SECONDARY_ENGINE: 20