MySQL HeatWave User Guide

5.4.7 Query Views

This topic describes how to run queries on views using MySQL HeatWave and verify if those queries are offloaded to the MySQL HeatWave secondary engine for accelerated processing.

Before You Begin

Query a View

MySQL HeatWave supports querying views. Ensure that all the tables included in the view are loaded in MySQL HeatWave. Queries executed on views are subject to the same offload prerequisites and limitations as queries executed on tables.

In the following example, a view is created on the airport table, described in AirportDB Analytics Quickstart. The example assumes the airport table is loaded in MySQL HeatWave.

mysql> CREATE VIEW airport_US AS
SELECT
    airport.* FROM airport 
    JOIN airport_geo,
    SING (airport_id) WHERE country = "UNITED STATES";

  
  

To determine if a query run on a view can be offloaded to MySQL HeatWave for execution, use EXPLAIN. If offload is supported, the Extra column of EXPLAIN output shows Using secondary engine RAPID, as in the following example:

mysql> EXPLAIN SELECT COUNT(*) FROM airport_US\G
*************************** 1. row ***************************
           id: 1
  select_type: NONE
        table: NULL
   partitions: NULL
         type: NULL
possible_keys: NULL
          key: NULL
      key_len: NULL
          ref: NULL
         rows: NULL
     filtered: NULL
        Extra: Using secondary engine RAPID. Use EXPLAIN FORMAT=TREE to show the plan.
1 row in set, 1 warning (0.2424 sec)

What's Next

Learn how to View Query Runtimes and Estimates