MySQL HeatWave User Guide

4.4.2 Unload Data Manually

This topic describes how to unload tables manually.

Before You Begin

Unload Tables

Unloading a table from MySQL HeatWave may be necessary to replace an existing table, to reload a table, to free up memory, or simply to remove a table that is no longer used.

To unload a table manually, specify the SECONDARY_UNLOAD clause in an ALTER TABLE statement:

mysql> ALTER TABLE tbl_name SECONDARY_UNLOAD;

The following example unloads the data_table_1 table.

mysql> ALTER TABLE data_table_1 SECONDARY_UNLOAD;

Data is removed from MySQL HeatWave only. The table contents on the DB System are not affected.

Unload Partitions

As of MySQL 9.1.0, MySQL HeatWave supports partitions for DB System tables. INFORMATION_SCHEMA.PARTITIONS includes a SECONDARY_LOAD column that indicates whether a partition is loaded. Review how to Load Partitions.

See the following to learn more:

When an unload operation successfully unloads the last partition, it unloads the whole table.

To unload partitions, specify the SECONDARY_UNLOAD clause in an ALTER TABLE statement.

mysql> ALTER TABLE tbl_name SECONDARY_UNLOAD PARTITION (p0, p1, ..., pn);

The following example unloads the p0 partition from data_table_1.

mysql> ALTER TABLE data_table_1 SECONDARY_UNLOAD PARTITION (p0);

If a partition unload fails, the table becomes stale.

What's Next