This topic provides information related to the
SELECT statement clauses
supported in MySQL HeatWave and describes how to use the GROUP
BY and QUALIFY clauses to group or
filter the processing results.
Review the requirements.
Verify if the query is offloaded to MySQL HeatWave for processing.
The following SELECT statement
clauses are supported in the MySQL HeatWave secondary engine.
-
GROUP BYclauseA
CUBEmodifier in addition to theWITH ROLLUPmodifier.CUBEmodifier is available only in secondary engine and is not supported in the DB System.A
ROLLUPmodifier as a preferred alternative to theWITH ROLLUPmodifier.
-
QUALIFYclause is added between theWINDOWclause and theORDER BYclause.QUALIFYclause is available only in secondary engine and is not supported in the DB System.In addition to constraints similar to the
HAVINGclause, theQUALIFYclause can also include predicates related to a window function.Similar to the
HAVINGclause, theQUALIFYclause can refer to aliases mentioned in theSELECTlist.The
QUALIFYclause requires the inclusion of at least one window function in the query. The window function can be part of any one of the following:The
SELECTcolumn list.A filter predicate of the
QUALIFYclause.
TABLESAMPLEclause is available only in secondary engine and is not supported in the DB System.
The following SELECT statement
syntax shows the clauses that are supported in the MySQL HeatWave
secondary engine.
SELECT
[ALL | DISTINCT | DISTINCTROW ]
[STRAIGHT_JOIN]
[SQL_BUFFER_RESULT]
select_expr [, select_expr] ...
[FROM table_references
[PARTITION partition_list]
[TABLESAMPLE { SYSTEM | BERNOULLI } (sample_percentage)]]
[WHERE where_condition]
[GROUP BY {{col_name | expr | position}, ... [WITH ROLLUP]
| {CUBE | ROLLUP} ({col_name | expr | position}, ...)}]
[HAVING where_condition]
[WINDOW window_name AS (window_spec)
[, window_name AS (window_spec)] ...]
[QUALIFY qualify_condition]
[ORDER BY {col_name | expr | position} [ASC | DESC], ...]
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
For a full explanation of the
SELECT syntax, see
SELECT Statement.
MySQL HeatWave uses a query optimization technique where some
conditions from HAVING clause are moved
earlier in the execution pipeline to reduce the amount of data
processed. This helps reduce the intermediate result set sizes
and identify data-related issues that might go unnoticed in
MySQL. However, this optimization technique changes the order
of operations performed as compared to a standard SQL
execution of the SELECT
statement on MySQL.
Learn how to explain a query and check query execution time.