Documentation Home
HeatWave User Guide
Related Documentation Download this Manual
PDF (US Ltr) - 3.8Mb
PDF (A4) - 3.8Mb


6.9.3 Unload a Model

The ML_MODEL_UNLOAD routine unloads a model from MySQL HeatWave AutoML. For ML_MODEL_UNLOAD parameter descriptions, see ML_MODEL_UNLOAD.

Before You Begin

Unload a Model

If you are on MySQL 9.0.0 or higher, you can verify what models are currently loaded with the ML_MODEL_ACTIVE routine before and after unloading the model.

  1. If you are on MySQL 9.0.0 or higher, verify what models are currently loaded with the ML_MODEL_ACTIVE routine.

    mysql> CALL sys.ML_MODEL_ACTIVE('all', @model_info);
  2. Select the session variable created to view all loaded models.

    mysql> SELECT JSON_PRETTY(@model_info);
    +-----------------------------------------------------------+
    | JSON_PRETTY(@model_info)                                  |
    +-----------------------------------------------------------+
    | [
      {
        "total model size(bytes)": 50209
      },
      {
        "user1": [
          {
            "recommendation_use_case": {
              "format": "HWMLv2.0",
              "model_size(byte)": 15609
            }
          },
          {
            "recommendation_use_case2": {
              "format": "HWMLv2.0",
              "model_size(byte)": 8766
            }
          },
          {
            "recommendation_use_case3": {
              "format": "HWMLv2.0",
              "model_size(byte)": 8402
            }
          },
          {
            "recommendation_use_case4": {
              "format": "HWMLv2.0",
              "model_size(byte)": 17432
            }
          }
        ]
      }
    ] |
    +-----------------------------------------------------------+
    1 row in set (0.0411 sec)
  3. Refer to the appropriate model handle to unload. Alternatively, use the session variable for the model handle.

    The following example unloads a model by using the model handle:

    mysql> CALL sys.ML_MODEL_UNLOAD('recommendation_use_case');

    Where:

    • recommendation_use_case is the model handle.

    The following example unloads a model by using the session variable for the model handle:

    mysql> CALL sys.ML_MODEL_UNLOAD(@recommendation_model);

    Where:

    • @recommendation_model is the assigned session variable for the model handle.

  4. If you are on MySQL 9.0.0, run ML_MODEL_ACTIVE again to confirm the model is successfully unloaded

    mysql> CALL sys.ML_MODEL_ACTIVE('all', @model_info);
    mysql> SELECT JSON_PRETTY(@model_info);
    +-----------------------------------------------------------+
    | JSON_PRETTY(@model_info)                                  |
    +-----------------------------------------------------------+
    | [
      {
        "total model size(bytes)": 34600
      },
      {
        "user1": [
          {
            "recommendation_use_case2": {
              "format": "HWMLv2.0",
              "model_size(byte)": 8766
            }
          },
          {
            "recommendation_use_case3": {
              "format": "HWMLv2.0",
              "model_size(byte)": 8402
            }
          },
          {
            "recommendation_use_case4": {
              "format": "HWMLv2.0",
              "model_size(byte)": 17432
            }
          }
        ]
      }
    ] |
    +-----------------------------------------------------------+
    1 row in set (0.0411 sec)

    The list of loaded models shows the model is unloaded.

What's Next