MySQL HeatWave User Guide
You can monitor the progress of MySQL HeatWave AutoML routines through Performance Schema queries made from a second MySQL Client session.
Review the following:
Progress tracking supports all MySQL HeatWave AutoML Routines. For each routine, progress tracking tracks each individual operation and stage within routines. Completed percentage values are also included.
ML_MODEL_IMPORT
only supports
progress tracking for models in ONNX format. It does not
support progress tracking for models in MySQL HeatWave AutoML format. See
Manage External ONNX
Models to learn more.
This example displays the stages for
ML_TRAIN
only. Other MySQL HeatWave AutoML
routines may have different stages to review.
To track progress while training a machine learning model:
Connect to your DB system from two different MySQL Client sessions.
From the first MySQL Client session, train a machine learning model. See Train a Model. The following example trains a classification machine learning model.
mysql> CALL sys.ML_TRAIN('census_data.census_train', 'revenue', JSON_OBJECT('task', 'classification'), @census_model);
While ML_TRAIN
runs, use the
second MySQL Client session and query the
performance_schema.rpd_query_stats
table, which stores data and statistics for for the
last 100 completed queries. You can limit the output to the
two most recent entries sorted by
QUERY_ID
in descending order. Optionally,
use \G
to display the output in an easily
readable format. The output is similar to the following:
mysql> SELECT * FROM performance_schema.rpd_query_stats ORDER BY QUERY_ID DESC limit 2\G
*************************** 131. row ***************************
QUERY_ID: 140
STATEMENT_ID: 7881043
CONNECTION_ID: 41436
QUERY_TEXT: ML_TRAIN
QEXEC_TEXT: {
"status": "In Progress",
"completedSteps": [
"Initialization",
"Preprocessing"
],
"completionPercentage": 22,
"totalRunTime": null,
"startTime": "04/22/2025, 15:09:23:287333 UTC",
"progressItems": [
{
"type": "Initialization",
"status": "Completed",
"lastUpdated": "04/22/2025, 15:09:28:235097 UTC",
"completionPercentage": 100
},
{
"type": "Preprocessing",
"status": "Completed",
"lastUpdated": "04/22/2025, 15:09:29:060563 UTC",
"completionPercentage": 100
},
{
"type": "Algorithm Selection",
"status": "In Progress",
"lastUpdated": "04/22/2025, 15:09:38:649341 UTC",
"completionPercentage": 98
},
{
"type": "Row Sampling",
"status": "Not Started",
"lastUpdated": "04/22/2025, 15:09:28:227493 UTC",
"completionPercentage": 0
},
{
"type": "Column Selection",
"status": "Not Started",
"lastUpdated": "04/22/2025, 15:09:28:227911 UTC",
"completionPercentage": 0
},
{
"type": "Hyperparameter Optimization",
"status": "Not Started",
"lastUpdated": "04/22/2025, 15:09:28:228325 UTC",
"completionPercentage": 0
},
{
"type": "Model Generation",
"status": "Not Started",
"lastUpdated": "04/22/2025, 15:09:28:228760 UTC",
"completionPercentage": 0
},
{
"type": "Prediction Explainer",
"status": "Not Started",
"lastUpdated": "04/22/2025, 15:09:28:229296 UTC",
"completionPercentage": 0
},
{
"type": "Model Explainer",
"status": "Not Started",
"lastUpdated": "04/22/2025, 15:09:28:229704 UTC",
"completionPercentage": 0
}
],
"details": {
"trainingScore": null,
"optimizationMetric": null,
"options": {
"task": "classification"
},
"operation": "training",
"user_name": "admin",
"table_name": "census_train",
"schema_name": "census_data",
"model_handle": "census_data.census_train_admin_1745334557047",
"target_column_name": "revenue"
}
}
QKRN_TEXT: {}
QEP_TEXT: {}
INTERNAL_OFFLOAD_FAIL_TEXT:
EXTERNAL_OFFLOAD_FAIL_TEXT:
OFFLOAD_FAIL_QUERY_SUBSTR_START: 0
OFFLOAD_FAIL_QUERY_SUBSTR_LEN: 0
EXPORT_FILE_PREFIX: NULL
*************************** 130. row ***************************
QUERY_ID: 139
STATEMENT_ID: 7881035
CONNECTION_ID: 41436
QUERY_TEXT: ML_LOAD_TABLE
QEXEC_TEXT: {
"status": "Completed",
"completedSteps": [],
"completionPercentage": 100,
"totalRunTime": "3.77 Seconds",
"startTime": "04/22/2025, 15:09:18:046900 UTC",
"progressItems": [],
"details": {}
}
QKRN_TEXT: {}
QEP_TEXT: {}
INTERNAL_OFFLOAD_FAIL_TEXT:
EXTERNAL_OFFLOAD_FAIL_TEXT:
OFFLOAD_FAIL_QUERY_SUBSTR_START: 0
OFFLOAD_FAIL_QUERY_SUBSTR_LEN: 0
EXPORT_FILE_PREFIX: NULL
131 rows in set (0.0753 sec)
Refer to the second entry to confirm that the table was
successfully loaded. It shows that the
ML_LOAD_TABLE
operation has a
status
of Completed
,
and a completionPercentage
of
100
. Refer to the first entry to review
the status and completion percentage for each stage of
ML_TRAIN
. It shows that the
ML_TRAIN
operation has a
status
of In Progress
,
with sub-tasks displaying values for
completionPercentage
.
When the status shows Completed
for all
ML_TRAIN
tasks, run the same
query again from either MySQL Client session for
performance_schema.rpd_query_stats
. Limit
the query to display the most recent
QUERY_ID
, which for this example is
143
. The output is similar to the
following:
mysql> SELECT * FROM performance_schema.rpd_query_stats WHERE QUERY_ID=143\G
*************************** 134. row ***************************
QUERY_ID: 143
STATEMENT_ID: 7884317
CONNECTION_ID: 41436
QUERY_TEXT: ML_UNLOAD_MODEL
QEXEC_TEXT: {
"status": "Completed",
"completedSteps": [],
"completionPercentage": 100,
"totalRunTime": "0.64 Seconds",
"startTime": "04/22/2025, 15:13:37:392368 UTC",
"progressItems": [],
"details": {
"operation": "unload_model",
"user_name": "admin",
"model_handle": "census_data.census_train_admin_1745334557047"
}
}
QKRN_TEXT: {}
QEP_TEXT: {}
INTERNAL_OFFLOAD_FAIL_TEXT:
EXTERNAL_OFFLOAD_FAIL_TEXT:
OFFLOAD_FAIL_QUERY_SUBSTR_START: 0
OFFLOAD_FAIL_QUERY_SUBSTR_LEN: 0
EXPORT_FILE_PREFIX: NULL
1 row in set (0.0729 sec)
Confirm that the status
shows
Completed
and the
completionPercentage
shows
100
.
You have the option to query only the status or completed percentage of a routine. This example loads and generates a table of predictions for the model previously trained.
Connect to your DB system from two different MySQL Client sessions.
From the first MySQL Client session, train a machine learning model. See Train a Model. The following example trains a classification machine learning model.
mysql> CALL sys.ML_TRAIN('census_data.census_train', 'revenue', JSON_OBJECT('task', 'classification'), @census_model);
Load the trained model. Replace
@census_model
with your own model
handle. See Load a
Model.
mysql> CALL sys.ML_MODEL_LOAD(@census_model
, NULL);
Use ML_PREDICT_TABLE
to
generate a table of predictions. See
Generate
Predictions for a Table. For example:
mysql> CALL sys.ML_PREDICT_TABLE('census_data.census_train', @census_model, 'census_data.census_train_predictions', NULL);
While the routine runs, use the second MySQL Client session
and create a session variable for
QEXEC_TEXT
. Query the
QUERY_TEXT
column for
ML_PREDICT_TABLE
, order the table by
QUERY_ID
in descending order, and only
query the most recent entry.
mysql> SELECT QEXEC_TEXT INTO @progress_json
FROM performance_schema.rpd_query_stats
WHERE QUERY_TEXT='ML_PREDICT_TABLE'
ORDER BY QUERY_ID
DESC limit 1;
From the second MySQL Client session, query the completion percentage for the routine.
mysql> SELECT JSON_EXTRACT(@progress_json, '$.completionPercentage');
+--------------------------------------------------------+
| JSON_EXTRACT(@progress_json, '$.completionPercentage') |
+--------------------------------------------------------+
| 67 |
+--------------------------------------------------------+
1 row in set (0.0463 sec)
Query the current status for the routine.
mysql> SELECT JSON_EXTRACT(@progress_json, '$.status');
+------------------------------------------+
| JSON_EXTRACT(@progress_json, '$.status') |
+------------------------------------------+
| "In Progress" |
+------------------------------------------+
1 row in set (0.0439 sec)
Review Machine Learning Use Cases to create machine learning models with sample datasets.