0% found this document useful (0 votes)
7 views

MySQL OCI Heatwave

Uploaded by

Lang Tu Mong Mo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

MySQL OCI Heatwave

Uploaded by

Lang Tu Mong Mo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 103

LAB

x_99052247@cloudshell:~ (us-ashburn-1)$ oci os object get -bn MYSQL_BUCKET --file setup.zip --name
setup6062.zip

Downloading object [####################################] 100%

x_99052247@cloudshell:~ (us-ashburn-1)$ ls

setup.zip

x_99052247@cloudshell:~ (us-ashburn-1)$ unzip setup.zip



mysql> alter table country modify HeadOfState char(60) NOT SECONDARY;

Query OK, 0 rows affected (0.01 sec)

Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table country modify Region char(26) NOT NULL comment
'RAPID_COLUMN=ENCODING=SORTED', MODIFY GovernmentForm char(45) not null comment
'RAPID_COLUMN=ENCODING=SORTED';

Query OK, 0 rows affected (0.01 sec)

Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table country secondary_engine=rapid;

Query OK, 0 rows affected (0.01 sec)

Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table country secondary_load;

Query OK, 0 rows affected (1.93 sec)

mysql> show create table country \G

*************************** 1. row ***************************

Table: country

Create Table: CREATE TABLE `country` (

`Code` char(3) NOT NULL DEFAULT '',

`Name` char(52) NOT NULL DEFAULT '',

`Continent` enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT


NULL DEFAULT 'Asia',

`Region` char(26) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=SORTED',

`SurfaceArea` decimal(10,2) NOT NULL DEFAULT '0.00',

`IndepYear` smallint DEFAULT NULL,

`Population` int NOT NULL DEFAULT '0',


`LifeExpectancy` decimal(3,1) DEFAULT NULL,

`GNP` decimal(10,2) DEFAULT NULL,

`GNPOld` decimal(10,2) DEFAULT NULL,

`LocalName` char(45) NOT NULL DEFAULT '',

`GovernmentForm` char(45) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=SORTED',

`HeadOfState` char(60) NOT SECONDARY DEFAULT NULL,

`Capital` int DEFAULT NULL,

`Code2` char(2) NOT NULL DEFAULT '',

PRIMARY KEY (`Code`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


SECONDARY_ENGINE=rapid

1 row in set (0.00 sec)

mysql> show create table country \G

*************************** 1. row ***************************

Table: country

Create Table: CREATE TABLE `country` (

`Code` char(3) NOT NULL DEFAULT '',

`Name` char(52) NOT NULL DEFAULT '',

`Continent` enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT


NULL DEFAULT 'Asia',

`Region` char(26) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=SORTED',

`SurfaceArea` decimal(10,2) NOT NULL DEFAULT '0.00',

`IndepYear` smallint DEFAULT NULL,

`Population` int NOT NULL DEFAULT '0',

`LifeExpectancy` decimal(3,1) DEFAULT NULL,

`GNP` decimal(10,2) DEFAULT NULL,

`GNPOld` decimal(10,2) DEFAULT NULL,

`LocalName` char(45) NOT NULL DEFAULT '',


`GovernmentForm` char(45) NOT NULL COMMENT 'RAPID_COLUMN=ENCODING=SORTED',

`HeadOfState` char(60) NOT SECONDARY DEFAULT NULL,

`Capital` int DEFAULT NULL,

`Code2` char(2) NOT NULL DEFAULT '',

PRIMARY KEY (`Code`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


SECONDARY_ENGINE=rapid

1 row in set (0.00 sec)

mysql> show create table city \G

*************************** 1. row ***************************

Table: city

Create Table: CREATE TABLE `city` (

`ID` int NOT NULL AUTO_INCREMENT,

`Name` char(35) NOT NULL DEFAULT '',

`CountryCode` char(3) NOT NULL DEFAULT '',

`District` char(20) NOT NULL DEFAULT '',

`Population` int NOT NULL DEFAULT '0',

PRIMARY KEY (`ID`),

KEY `CountryCode` (`CountryCode`),

CONSTRAINT `city_ibfk_1` FOREIGN KEY (`CountryCode`) REFERENCES `country` (`Code`)

) ENGINE=InnoDB AUTO_INCREMENT=4080 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

1 row in set (0.00 sec)

mysql> alter table city Modify CountryCode char(3) not null comment
'RAPID_COLUMN=DATA_PLACEMENT_KEY=1';

Query OK, 0 rows affected (0.01 sec)

Records: 0 Duplicates: 0 Warnings: 0


mysql> alter table city secondary_engine=rapid;

Query OK, 0 rows affected (0.01 sec)

Records: 0 Duplicates: 0 Warnings: 0

mysql> alter table city secondary_load;

Query OK, 0 rows affected (0.47 sec)

mysql> show create table city \G

*************************** 1. row ***************************

Table: city

Create Table: CREATE TABLE `city` (

`ID` int NOT NULL AUTO_INCREMENT,

`Name` char(35) NOT NULL DEFAULT '',

`CountryCode` char(3) NOT NULL COMMENT 'RAPID_COLUMN=DATA_PLACEMENT_KEY=1',

`District` char(20) NOT NULL DEFAULT '',

`Population` int NOT NULL DEFAULT '0',

PRIMARY KEY (`ID`),

KEY `CountryCode` (`CountryCode`),

CONSTRAINT `city_ibfk_1` FOREIGN KEY (`CountryCode`) REFERENCES `country` (`Code`)

) ENGINE=InnoDB AUTO_INCREMENT=4080 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci


SECONDARY_ENGINE=rapid

1 row in set (0.00 sec)


mysql> show databases;

+--------------------+

| Database |

+--------------------+

| airportdb |

| information_schema |

| mysql |

| mysql_audit |

| performance_schema |

| sys |

| world |

+--------------------+

7 rows in set (0.00 sec)

mysql> CALL sys.heatwave_load(JSON_ARRAY('airportdb'),JSON_OBJECT('output','help'));

+------------------------------------------+

| INITIALIZING HEATWAVE AUTO PARALLEL LOAD |

+------------------------------------------+

| Version: 2.20 |

| |

| Load Mode: normal |


| Load Policy: disable_unsupported_columns |

| Output Mode: help |

| |

+------------------------------------------+

6 rows in set (0.02 sec)

+--------------------------------------------------------------------------------------------------------+

| USAGE DOCUMENTATION |

+--------------------------------------------------------------------------------------------------------+

| Interface: |

| CALL sys.heatwave_load(db_list, options); |

| |

| Input Arguments: |

| db_list: (Mandatory) JSON_ARRAY of schema names |

| options: (Optional) JSON_OBJECT for options |

| key: "mode", value_type: enum("normal", "dryrun") |

| // dryrun mode: Only generates load script (does not load the tables) |

| // normal mode (DEFAULT): Generates the load script and also loads data into HeatWave |

| key: "output" value_type: enum("normal", "compact", "silent", "help") |

| // normal output (DEFAULT): Produces detailed output on stdout in addition to temp table |

| // compact output: Produces summarized output (and errors) on stdout in addition to temp table
|

| // silent output: Only produces temp table output. Useful for scripting |

| // help output: Shows this output |

| key: "sql_mode" value_type: string |

| // valid string containing SQL_MODE (Session variable SQL_MODE is not used by Auto Load) |

| key: "policy" value_type: enum("disable_unsupported_columns",


"not_disable_unsupported_columns") |

| // not_disable_unsupported_columns policy: Does not load table if an unsupported column exists


|
| // disable_unsupported_columns policy (DEFAULT): Load the table by disabling unsupported
columns |

| key: "exclude_list" value_type: array of strings (JSON_ARRAY) |

| // List of database objects to be explicitly excluded from load |

| // Fully qualified names of tables and columns are expected without backticks |

| key: "set_load_parallelism" value_type: boolean |

| // Enabled by default. When enabled dynamically sets the load parallelism for each table |

| key: "use_load_time_estimation" value_type: boolean |

| // Enabled by default. When enabled, produces load time estimates. |

| key: "auto_enc" value_type: JSON_OBJECT for configuring Auto Encoding |

| key: "mode" value_type: enum("off", "check") |

| // check (DEFAULT). Produce MySQL node footprint estimates for tables |

| key: "external_tables" value_type: JSON_OBJECT for passing options to load external tables |

| |

| Output: |

| Temporary table: "sys.heatwave_autopilot_report" |

| |

| Examples: |

| CALL sys.heatwave_load(JSON_ARRAY("db1"),NULL); |

| CALL sys.heatwave_load(JSON_ARRAY("db1","db2"), JSON_OBJECT("mode","normal","policy",


|

| "disable_unsupported_columns","exclude_list",JSON_ARRAY("db1.tbl1","db2.tbl1.col1"))); |

+--------------------------------------------------------------------------------------------------------+

38 rows in set (0.02 sec)

Query OK, 0 rows affected (0.02 sec)

mysql> CALL sys.heatwave_load(JSON_ARRAY('airportdb'),JSON_OBJECT('mode','dryrun'));

+------------------------------------------+
| INITIALIZING HEATWAVE AUTO PARALLEL LOAD |

+------------------------------------------+

| Version: 2.20 |

| |

| Load Mode: dryrun |

| Load Policy: disable_unsupported_columns |

| Output Mode: normal |

| |

+------------------------------------------+

6 rows in set (0.01 sec)

+-----------------------------------------------------------------------------------------------+

| OFFLOAD ANALYSIS |

+-----------------------------------------------------------------------------------------------+

| Verifying input schemas: 1 |

| User excluded items: 0 |

| |

| SCHEMA OFFLOADABLE OFFLOADABLE SUMMARY OF |

| NAME TABLES COLUMNS ISSUES |

| ------ ----------- ----------- ---------- |

| `airportdb` 14 105 1 table(s) are partially loadable |

| |

| Total offloadable schemas: 1 |

| |

+-----------------------------------------------------------------------------------------------+

10 rows in set (0.36 sec)

+-----------------------------------------------------------------------------------------------------------------------------+

| CAPACITY ESTIMATION |
+-----------------------------------------------------------------------------------------------------------------------------+

| Default encoding for string columns: VARLEN (unless specified in the schema)
|

| Estimating memory footprint for 1 schema(s) |

| |

| TOTAL ESTIMATED ESTIMATED TOTAL DICTIONARY VARLEN


ESTIMATED |

| SCHEMA OFFLOADABLE HEATWAVE NODE MYSQL NODE STRING ENCODED


ENCODED LOAD |

| NAME TABLES FOOTPRINT FOOTPRINT COLUMNS COLUMNS COLUMNS


TIME |

| ------ ----------- --------- --------- ------- ---------- ------- --------- |

| `airportdb` 14 1.74 GiB 7.44 MiB 36 0 36 18.00 s |

| |

| Sufficient MySQL host memory available to load all tables. |

| Sufficient HeatWave cluster memory available to load all tables. |

| |

+-----------------------------------------------------------------------------------------------------------------------------+

12 rows in set (0.38 sec)

+-------------------------------------------------------------------------------------------------------------+

| LOAD SCRIPT GENERATION |

+-------------------------------------------------------------------------------------------------------------+

| Dryrun mode only generates the load script |

| Set mode to "normal" in options to load tables |

| |

| Retrieve load script containing 43 generated DDL commands using the query below: |

| Deprecation Notice: "heatwave_load_report" will be deprecated, please switch to


"heatwave_autopilot_report" |

| SELECT log->>"$.sql" AS "Load Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |
| |

| Applying changes will take approximately 18.00 s |

| |

| Caution: Executing the generated load script will affect the secondary engine flags in the schema
|

| |

+-------------------------------------------------------------------------------------------------------------+

11 rows in set (0.38 sec)

Query OK, 0 rows affected (0.38 sec)

mysql> CALL
sys.heatwave_load(JSON_ARRAY('airportdb'),JSON_OBJECT('mode','dryrun','policy','not_disable_unsupp
orted_columns'));

+----------------------------------------------+

| INITIALIZING HEATWAVE AUTO PARALLEL LOAD |

+----------------------------------------------+

| Version: 2.20 |

| |

| Load Mode: dryrun |

| Load Policy: not_disable_unsupported_columns |

| Output Mode: normal |

| |

+----------------------------------------------+

6 rows in set (0.00 sec)

+-----------------------------------------------------------------------------------------+

| OFFLOAD ANALYSIS |

+-----------------------------------------------------------------------------------------+

| Verifying input schemas: 1 |


| User excluded items: 0 |

| |

| SCHEMA OFFLOADABLE OFFLOADABLE SUMMARY OF |

| NAME TABLES COLUMNS ISSUES |

| ------ ----------- ----------- ---------- |

| `airportdb` 13 99 1 table(s) are not loadable |

| |

| Total offloadable schemas: 1 |

| |

+-----------------------------------------------------------------------------------------+

10 rows in set (0.08 sec)

+-----------------------------------------------------------------------------------------------------------------------------+

| CAPACITY ESTIMATION |

+-----------------------------------------------------------------------------------------------------------------------------+

| Default encoding for string columns: VARLEN (unless specified in the schema)
|

| Estimating memory footprint for 1 schema(s) |

| |

| TOTAL ESTIMATED ESTIMATED TOTAL DICTIONARY VARLEN


ESTIMATED |

| SCHEMA OFFLOADABLE HEATWAVE NODE MYSQL NODE STRING ENCODED


ENCODED LOAD |

| NAME TABLES FOOTPRINT FOOTPRINT COLUMNS COLUMNS COLUMNS


TIME |

| ------ ----------- --------- --------- ------- ---------- ------- --------- |

| `airportdb` 13 1.74 GiB 7.00 MiB 33 0 33 17.00 s |

| |

| Sufficient MySQL host memory available to load all tables. |

| Sufficient HeatWave cluster memory available to load all tables. |


| |

+-----------------------------------------------------------------------------------------------------------------------------+

12 rows in set (0.10 sec)

+-------------------------------------------------------------------------------------------------------------+

| LOAD SCRIPT GENERATION |

+-------------------------------------------------------------------------------------------------------------+

| Dryrun mode only generates the load script |

| Set mode to "normal" in options to load tables |

| |

| Retrieve load script containing 39 generated DDL commands using the query below: |

| Deprecation Notice: "heatwave_load_report" will be deprecated, please switch to


"heatwave_autopilot_report" |

| SELECT log->>"$.sql" AS "Load Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| Applying changes will take approximately 17.00 s |

| |

| Caution: Executing the generated load script will affect the secondary engine flags in the schema
|

| |

+-------------------------------------------------------------------------------------------------------------+

11 rows in set (0.10 sec)

Query OK, 0 rows affected (0.10 sec)

mysql> CALL sys.heatwave_load(JSON_ARRAY('airportdb'),JSON_OBJECT('output','compact'));

+------------------------------------------+

| INITIALIZING HEATWAVE AUTO PARALLEL LOAD |

+------------------------------------------+
| Version: 2.20 |

| |

| Load Mode: normal |

| Load Policy: disable_unsupported_columns |

| Output Mode: compact |

| |

+------------------------------------------+

6 rows in set (0.01 sec)

+-----------------------------------------------------------------------------------------------+

| OFFLOAD ANALYSIS |

+-----------------------------------------------------------------------------------------------+

| Verifying input schemas: 1 |

| User excluded items: 0 |

| |

| SCHEMA OFFLOADABLE OFFLOADABLE SUMMARY OF |

| NAME TABLES COLUMNS ISSUES |

| ------ ----------- ----------- ---------- |

| `airportdb` 14 105 1 table(s) are partially loadable |

| |

| Total offloadable schemas: 1 |

| |

+-----------------------------------------------------------------------------------------------+

10 rows in set (0.09 sec)

+-----------------------------------------------------------------------------------------------------------------------------+

| CAPACITY ESTIMATION |

+-----------------------------------------------------------------------------------------------------------------------------+
| Default encoding for string columns: VARLEN (unless specified in the schema)
|

| Estimating memory footprint for 1 schema(s) |

| |

| TOTAL ESTIMATED ESTIMATED TOTAL DICTIONARY VARLEN


ESTIMATED |

| SCHEMA OFFLOADABLE HEATWAVE NODE MYSQL NODE STRING ENCODED


ENCODED LOAD |

| NAME TABLES FOOTPRINT FOOTPRINT COLUMNS COLUMNS COLUMNS


TIME |

| ------ ----------- --------- --------- ------- ---------- ------- --------- |

| `airportdb` 14 1.74 GiB 7.44 MiB 36 0 36 18.00 s |

| |

| Sufficient MySQL host memory available to load all tables. |

| Sufficient HeatWave cluster memory available to load all tables. |

| |

+-----------------------------------------------------------------------------------------------------------------------------+

12 rows in set (0.10 sec)

+---------------------------------------------------------------------------------------------------------------------------------------+

| EXECUTING LOAD |

+---------------------------------------------------------------------------------------------------------------------------------------+

| HeatWave Load script generated |

| Retrieve load script containing 43 generated DDL command(s) using the query below:
|

| Deprecation Notice: "heatwave_load_report" will be deprecated, please switch to


"heatwave_autopilot_report" |

| SELECT log->>"$.sql" AS "Load Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| Adjusting load parallelism dynamically per internal/external table.


|
| Using current parallelism of 32 thread(s) as maximum for internal tables.
|

| |

| Using SQL_MODE:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVIS
ION_BY_ZERO,NO_ENGINE_SUBSTITUTION |

| |

| Proceeding to load 14 table(s) into HeatWave. |

| |

| Applying changes will take approximately 17.39 s |

| |

+---------------------------------------------------------------------------------------------------------------------------------------+

14 rows in set (0.11 sec)

+-------------------------------------------------------------------------------+

| LOAD SUMMARY |

+-------------------------------------------------------------------------------+

| |

| SCHEMA TABLES TABLES COLUMNS LOAD |

| NAME LOADED FAILED LOADED DURATION |

| ------ ------ ------ ------- -------- |

| `airportdb` 14 0 105 2.13 min |

| |

+-------------------------------------------------------------------------------+

6 rows in set (2 min 7.80 sec)

Query OK, 0 rows affected (2 min 7.80 sec)

mysql> select log->> "$.sql" AS "Load script" from

-> sys.heatwave_autopilot_report
-> where type='sql'

-> order by id \g

+-----------------------------------------------------------------------------------------------------+

| Load script |

+-----------------------------------------------------------------------------------------------------+

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`airline` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`airline` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`airplane` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`airplane` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`airplane_type` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`airplane_type` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`airport` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`airport` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`airport_geo` MODIFY `geolocation` point NOT NULL COMMENT '' NOT
SECONDARY; |

| ALTER TABLE `airportdb`.`airport_geo` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`airport_geo` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 32; |

| ALTER TABLE `airportdb`.`booking` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`booking` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |


| ALTER TABLE `airportdb`.`employee` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`employee` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 9; |

| ALTER TABLE `airportdb`.`flight` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`flight` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`flight_log` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`flight_log` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`flightschedule` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`flightschedule` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`passenger` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`passenger` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 1; |

| ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_LOAD; |

| SET SESSION innodb_parallel_read_threads = 18; |

| ALTER TABLE `airportdb`.`weatherdata` SECONDARY_ENGINE=RAPID; |

| ALTER TABLE `airportdb`.`weatherdata` SECONDARY_LOAD; |

+-----------------------------------------------------------------------------------------------------+

43 rows in set (0.00 sec)


mysql> select variable_value from performance_schema.global_status where
variable_name='rapid_load_progress';

+----------------+

| variable_value |

+----------------+

| 100.000000 |

+----------------+

1 row in set (0.00 sec)

mysql> select name, load_progress

-> from performance_schema.rpd_tables JOIN performance_schema.rpd_table_id using(id);

+-----------------------------+---------------+

| name | load_progress |

+-----------------------------+---------------+

| world.city | 100 |

| airportdb.flight_log | 100 |

| airportdb.airport_geo | 100 |

| airportdb.flight | 100 |

| airportdb.passengerdetails | 100 |

| airportdb.passenger | 100 |

| airportdb.airplane | 100 |
| airportdb.weatherdata | 100 |

| airportdb.flightschedule | 100 |

| airportdb.booking | 100 |

| airportdb.employee | 100 |

| airportdb.airplane_type | 100 |

| airportdb.airport | 100 |

| world.country | 100 |

| airportdb.airline | 100 |

| airportdb.airport_reachable | 100 |

+-----------------------------+---------------+

16 rows in set (0.00 sec)

mysql> select name, load_status

-> from performance_schema.rpd_tables JOIN performance_schema.rpd_table_id using(id);

+-----------------------------+---------------------+

| name | load_status |

+-----------------------------+---------------------+

| world.city | AVAIL_RPDGSTABSTATE |

| airportdb.flight_log | AVAIL_RPDGSTABSTATE |

| airportdb.airport_geo | AVAIL_RPDGSTABSTATE |

| airportdb.flight | AVAIL_RPDGSTABSTATE |

| airportdb.passengerdetails | AVAIL_RPDGSTABSTATE |

| airportdb.passenger | AVAIL_RPDGSTABSTATE |

| airportdb.airplane | AVAIL_RPDGSTABSTATE |

| airportdb.weatherdata | AVAIL_RPDGSTABSTATE |

| airportdb.flightschedule | AVAIL_RPDGSTABSTATE |

| airportdb.booking | AVAIL_RPDGSTABSTATE |

| airportdb.employee | AVAIL_RPDGSTABSTATE |

| airportdb.airplane_type | AVAIL_RPDGSTABSTATE |
| airportdb.airport | AVAIL_RPDGSTABSTATE |

| world.country | AVAIL_RPDGSTABSTATE |

| airportdb.airline | AVAIL_RPDGSTABSTATE |

| airportdb.airport_reachable | AVAIL_RPDGSTABSTATE |

+-----------------------------+---------------------+

16 rows in set (0.00 sec)

mysql> select name, pool_type from performance_schema.rpd_tables JOIN


performance_schema.rpd_table_id using(id);

+-----------------------------+-------------------------------+

| name | pool_type |

+-----------------------------+-------------------------------+

| world.city | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.flight_log | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.airport_geo | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.flight | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.passengerdetails | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.passenger | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.airplane | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.weatherdata | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.flightschedule | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.booking | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.employee | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.airplane_type | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.airport | RAPID_LOAD_POOL_TRANSACTIONAL |

| world.country | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.airline | RAPID_LOAD_POOL_TRANSACTIONAL |

| airportdb.airport_reachable | RAPID_LOAD_POOL_TRANSACTIONAL |

+-----------------------------+-------------------------------+
16 rows in set (0.00 sec)

mysql> alter table city secondary_unload;

Query OK, 0 rows affected (0.01 sec)

mysql> alter table city secondary_engine=null;

Query OK, 0 rows affected (0.01 sec)

Records: 0 Duplicates: 0 Warnings: 0

mysql> show create table city \G

*************************** 1. row ***************************

Table: city

Create Table: CREATE TABLE `city` (

`ID` int NOT NULL AUTO_INCREMENT,

`Name` char(35) NOT NULL DEFAULT '',

`CountryCode` char(3) NOT NULL COMMENT 'RAPID_COLUMN=DATA_PLACEMENT_KEY=1',

`District` char(20) NOT NULL DEFAULT '',

`Population` int NOT NULL DEFAULT '0',

PRIMARY KEY (`ID`),

KEY `CountryCode` (`CountryCode`),

CONSTRAINT `city_ibfk_1` FOREIGN KEY (`CountryCode`) REFERENCES `country` (`Code`)


) ENGINE=InnoDB AUTO_INCREMENT=4080 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci

1 row in set (0.00 sec)

mysql> CALL sys.heatwave_unload(JSON_ARRAY('world'),JSON_OBJECT('output','help'));

+-----------------------------------------------------------------------------------------------------------------------------------------
+

| USAGE DOCUMENTATION |

+-----------------------------------------------------------------------------------------------------------------------------------------
+

| Interface: |

| CALL sys.heatwave_unload(db_list, options); |

| |

| Input Arguments: |

| db_list: (Mandatory) JSON_ARRAY of schema names |

| options: (Optional) JSON_OBJECT for options |

| key: "exclude_list" value_type: JSON_ARRAY // array of tables from a specific schema to be


excluded from the unload procedure. |

| key: "mode", value_type: enum("normal", "dryrun") |

| // dryrun mode: only produces the report without actually unloading the tables.
|

| // normal mode (DEFAULT): unloads the schemas from Heatwave and produces an unload report.
|

| key: "output" value_type: enum("normal", "silent", "help")


|

| // normal output (DEFAULT): Produces detailed output on stdout in addition to temp table.
|

| // silent output: Only produces temp table output. Useful for scripting.
|

| // help output: Shows this output. |

| Output: |

| Temporary table: "sys.heatwave_unload_report" |

| |
| Examples: |

| CALL sys.heatwave_unload(JSON_ARRAY(""), JSON_OBJECT("output", "help"));


|

| CALL sys.heatwave_unload(JSON_ARRAY("db1"), NULL);


|

| CALL sys.heatwave_unload( |

| JSON_ARRAY("tpch128", "tpch1"), |

| JSON_OBJECT( |

| "exclude_list", JSON_ARRAY("tpch1.LINEITEM") |

| ) |

| ); |

| CALL sys.heatwave_unload( |

| JSON_ARRAY("tpch128", "tpch1"), |

| JSON_OBJECT( |

| "exclude_list",JSON_ARRAY("tpch1.LINEITEM"), |

| "mode", "dryrun", |

| "output", "silent" |

| ) |

| ); |

+-----------------------------------------------------------------------------------------------------------------------------------------
+

34 rows in set (0.01 sec)

Query OK, 0 rows affected (0.01 sec)

mysql> CALL sys.heatwave_unload(JSON_ARRAY('world'),NULL);

+-----------------------------------+

| INITIALIZING HEATWAVE AUTO UNLOAD |

+-----------------------------------+
| |

| |

| Unload mode: normal |

| Unload output: normal |

| Unload exclude_list: [] |

| |

+-----------------------------------+

6 rows in set (0.00 sec)

+--------------------------------------------------------------------------------------------------------------+

| HEATWAVE UNLOAD |

+--------------------------------------------------------------------------------------------------------------+

| |

| |

| SCHEMA TABLES TABLES MEMORY GAIN MEMORY GAIN |

| NAME TO UNLOAD TO REMAIN (HEATWAVE NODES) (HOST) |

| ------- ----------- ----------- ------------------------------- -------------------- |

| `world` 1 0 44.00 MiB 68.25 MiB |

| |

| TOTAL 1 0 44.00 MiB 68.25 MiB |

| |

| Memory consumed by base relations after unload: 2.12 GiB |

| |

+--------------------------------------------------------------------------------------------------------------+

11 rows in set (0.01 sec)

+---------------------------------------------------------------------------------------------------------------+

| EXECUTING UNLOAD |

+---------------------------------------------------------------------------------------------------------------+
| HeatWave Unload script generated |

| Retrieve unload script containing 2 generated DDL commands using the query below: |

| SELECT log->>"$.sql" AS "Unload Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| |

| Proceeding to unload 1 tables from HeatWave |

| |

+---------------------------------------------------------------------------------------------------------------+

7 rows in set (0.01 sec)

+----------------------------------------+

| UNLOAD EXECUTE |

+----------------------------------------+

| Commands executed successfully: 2 of 2 |

| Warnings encountered: 0 |

+----------------------------------------+

2 rows in set (0.03 sec)

Query OK, 0 rows affected (0.03 sec)

mysql> select log->> "$.sql" AS "UnLoad script" from sys.heatwave_autopilot_report where type='sql'
order by id;

+------------------------------------------------------+

| UnLoad script |

+------------------------------------------------------+

| ALTER TABLE `world`.`country` SECONDARY_UNLOAD; |

| ALTER TABLE `world`.`country` SECONDARY_ENGINE=NULL; |

+------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> CALL sys.heatwave_unload(JSON_ARRAY('airportdb'),JSON_OBJECT('mode','dryrun'));

+-----------------------------------+

| INITIALIZING HEATWAVE AUTO UNLOAD |

+-----------------------------------+

| |

| |

| Unload mode: dryrun |

| Unload output: normal |

| Unload exclude_list: [] |

| |

+-----------------------------------+

6 rows in set (0.01 sec)

+--------------------------------------------------------------------------------------------------------------+

| HEATWAVE UNLOAD |

+--------------------------------------------------------------------------------------------------------------+

| |

| |

| SCHEMA TABLES TABLES MEMORY GAIN MEMORY GAIN |

| NAME TO UNLOAD TO REMAIN (HEATWAVE NODES) (HOST) |

| ------- ----------- ----------- ------------------------------- -------------------- |

| `airportdb` 14 0 2.12 GiB 0 bytes |

| |

| TOTAL 14 0 2.12 GiB 0 bytes |

| |

| Memory consumed by base relations after unload: 0 bytes |

| |
+--------------------------------------------------------------------------------------------------------------+

11 rows in set (0.01 sec)

+---------------------------------------------------------------------------------------------------------------+

| UNLOAD SCRIPT GENERATION |

+---------------------------------------------------------------------------------------------------------------+

| Dryrun mode only generates the unload script |

| Set mode to "normal" in options to unload tables |

| Retrieve unload script containing 28 generated DDL commands using the query below:
|

| SELECT log->>"$.sql" AS "Unload Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| |

| Caution: Executing the generated unload script will affect the secondary engine flags in the schema
|

| Caution: Executing the generated unload script will unload tables. Queries on these tables will
|

| no longer be offloaded to HeatWave. |

| |

+---------------------------------------------------------------------------------------------------------------+

10 rows in set (0.01 sec)

Query OK, 0 rows affected (0.01 sec)

mysql> select log->> "$.sql" AS "UnLoad script" from sys.heatwave_autopilot_report where type='sql'
order by id;

+--------------------------------------------------------------------+

| UnLoad script |

+--------------------------------------------------------------------+
| ALTER TABLE `airportdb`.`airline` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airline` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airplane` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airplane` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airplane_type` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airplane_type` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airport` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airport` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airport_geo` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airport_geo` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`booking` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`booking` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`employee` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`employee` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`flight` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`flight` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`flight_log` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`flight_log` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`flightschedule` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`flightschedule` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`passenger` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`passenger` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`weatherdata` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`weatherdata` SECONDARY_ENGINE=NULL; |

+--------------------------------------------------------------------+
28 rows in set (0.00 sec)

mysql> explain select distinct country from airport_geo order by country \G

mysql> explain select flight_id , count(*) from booking group by flight_id \G


462553 rows in set (1 min 0.36 sec)

462553 rows in set (1.26 sec)

mysql> set optimizer_trace="enabled=on";

Query OK, 0 rows affected (0.00 sec)


mysql> set optimizer_trace_offset=-2;

Query OK, 0 rows affected (0.00 sec)

mysql> explain select distinct country from airport_geo order by country \G

*************************** 1. row ***************************

id: 1

select_type: SIMPLE

table: airport_geo

partitions: NULL

type: ALL

possible_keys: NULL

key: NULL

key_len: NULL

ref: NULL

rows: 9369

filtered: 100.00

Extra: Using temporary; Using filesort

1 row in set, 1 warning (0.00 sec)

mysql> select query, trace-> '$**.Rapid_Offload_Fails' 'Offload Failed' , trace-


>'$**.secondary_engine_not_used' 'Heatwave Not Used' from information_schema.optimizer_trace\G

*************************** 1. row ***************************

query: explain select distinct country from airport_geo order by country

Offload Failed: NULL

Heatwave Not Used: [{"cost": 10330.1, "reason": "The estimated query cost does not exceed
secondary_engine_cost_threshold.", "threshold": 100000}]

1 row in set (0.00 sec)

mysql> explain select flightno, f.name , f.geolocation , t.name, t.geolocation


-> from flight join airport_geo f on `from`=f.airport_id join airport_geo t on `to`=t.airport_id \G

*************************** 1. row ***************************

id: 1

select_type: SIMPLE

table: flight

partitions: NULL

type: ALL

possible_keys: from_idx,to_idx

key: NULL

key_len: NULL

ref: NULL

rows: 461286

filtered: 100.00

Extra: NULL

*************************** 2. row ***************************

id: 1

select_type: SIMPLE

table: f

partitions: NULL

type: eq_ref

possible_keys: PRIMARY

key: PRIMARY

key_len: 2

ref: airportdb.flight.from

rows: 1

filtered: 100.00

Extra: NULL

*************************** 3. row ***************************

id: 1
select_type: SIMPLE

table: t

partitions: NULL

type: eq_ref

possible_keys: PRIMARY

key: PRIMARY

key_len: 2

ref: airportdb.flight.to

rows: 1

filtered: 100.00

Extra: NULL

3 rows in set, 1 warning (0.00 sec)

mysql> select query, trace-> '$**.Rapid_Offload_Fails' 'Offload Failed' , trace-


>'$**.secondary_engine_not_used' 'Heatwave Not Used' from information_schema.optimizer_trace\G

*************************** 1. row ***************************

query: explain select flightno, f.name , f.geolocation , t.name, t.geolocation

from flight join airport_geo f on `from`=f.airport_id join airport_geo t on `to`=t.airport_id

Offload Failed: NULL

Heatwave Not Used: [{"reason": "Column geolocation is marked as NOT SECONDARY."}]

1 row in set (0.00 sec)

mysql> explain select flightno , timediff(arrival, departure) from flight join booking using (flight_id) \G

*************************** 1. row ***************************

id: 1

select_type: SIMPLE

table: flight

partitions: NULL

type: ALL
possible_keys: PRIMARY

key: NULL

key_len: NULL

ref: NULL

rows: 461286

filtered: 100.00

Extra: NULL

*************************** 2. row ***************************

id: 1

select_type: SIMPLE

table: booking

partitions: NULL

type: ref

possible_keys: seatplan_unq,flight_idx

key: flight_idx

key_len: 4

ref: airportdb.flight.flight_id

rows: 97

filtered: 100.00

Extra: Using index

2 rows in set, 1 warning (0.01 sec)

mysql> select query, trace-> '$**.Rapid_Offload_Fails' 'Offload Failed' , trace-


>'$**.secondary_engine_not_used' 'Heatwave Not Used' from information_schema.optimizer_trace\G

*************************** 1. row ***************************

query: explain select flightno , timediff(arrival, departure) from flight join booking using (flight_id)

Offload Failed: [{"Reason": "Function 'timediff' is not yet supported"}]

Heatwave Not Used: NULL

1 row in set (0.01 sec)


mysql> explain select station, weather, count(distinct log_date)

-> from weatherdata

-> group by station, weather \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.01 sec)

mysql> alter table weatherdata secondary_unload;

Query OK, 0 rows affected (0.01 sec)

mysql> explain select station, weather, count(distinct log_date) from weatherdata group by station,
weather\G

*************************** 1. row ***************************

id: 1

select_type: SIMPLE

table: weatherdata

partitions: NULL
type: ALL

possible_keys: NULL

key: NULL

key_len: NULL

ref: NULL

rows: 4626581

filtered: 100.00

Extra: Using filesort

1 row in set, 1 warning (0.00 sec)

mysql> select query, trace-> '$**.Rapid_Offload_Fails' 'Offload Failed' , trace-


>'$**.secondary_engine_not_used' 'Heatwave Not Used' from information_schema.optimizer_trace\G

*************************** 1. row ***************************

query: explain select station, weather, count(distinct log_date) from weatherdata group by
station, weather

Offload Failed: [{"Reason": "Table `airportdb`.`weatherdata` is not loaded in HeatWave"}]

Heatwave Not Used: NULL

1 row in set (0.00 sec)

mysql> CALL sys.heatwave_advisor(JSON_OBJECT('query_insights',TRUE));

+-------------------------------+
| INITIALIZING HEATWAVE ADVISOR |

+-------------------------------+

| Version: 2.20 |

| |

| Output Mode: normal |

| Excluded Queries: 0 |

| Target Schemas: All |

| |

+-------------------------------+

6 rows in set (0.01 sec)

+---------------------------------------------------------+

| ANALYZING LOADED DATA |

+---------------------------------------------------------+

| Total 13 tables loaded in HeatWave for 1 schemas |

| Tables excluded by user: 0 (within target schemas) |

| |

| SCHEMA TABLES COLUMNS |

| NAME LOADED LOADED |

| ------ ------ ------ |

| `airportdb` 13 96 |

| |

+---------------------------------------------------------+

8 rows in set (0.03 sec)

+--------------------------------------------------------------------------------------------------------------------+

| QUERY INSIGHTS |

+--------------------------------------------------------------------------------------------------------------------+

| Queries executed on Heatwave: 12 |


| Session IDs (as filter): None |

| |

| QUERY-ID SESSION-ID QUERY-STRING EXEC-RUNTIME (s) COMMENT |

| -------- ---------- ------------ ---------------- ------- |

| 1 60 select flight_id , count(*) from booking group by flight_id 0.269 (est.) Explain. |

| 2 60 select flight_id , count(*) from booking group by flight_id 0.269 (est.) Explain. |

| 3 60 select flight_id , count(*) from booking group by flight_id 0.269 (est.) Explain. |

| 4 60 select flight_id , count(*) from booking group by flight_id 1.249 |

| 5 60 select count(*) from booking 0.001 (est.) Explain. |

| 6 60 select count(*) from booking 0.025 |

| 9 60 select station, weather, count(distinct log_date) from weat... 0.073 (est.) Explain. |

| 11 60 SELECT flight_id, COUNT(*), SUM(price) FROM booking GROUP BY... 0.774


|

| 13 60 SELECT airlinename 'Airline Name', SUM(sold_seat)/SUM(capaci... 0.598 |

| 14 60 SELECT airlinename 'Airline Name', YEAR(departure) 'Year', M... 0.650 |

| 15 60 SELECT flightno 'Flight Number', FR.name 'Origin Airport', D... 0.873 |

| 16 60 SELECT flightno 'Flight Number', FR.name 'Origin Airport', D... 0.903 |

| |

| TOTAL ESTIMATED: 5 EXEC-RUNTIME: 0.881 sec |

| TOTAL EXECUTED: 7 EXEC-RUNTIME: 5.071 sec |

| |

| |

| Retrieve detailed query statistics using the query below: |

| SELECT log FROM sys.heatwave_autopilot_report WHERE stage = "QUERY_INSIGHTS" AND type =


"info"; |

| |

+--------------------------------------------------------------------------------------------------------------------+

25 rows in set (0.30 sec)


Query OK, 0 rows affected (0.30 sec)

mysql> select log from sys.heatwave_autopilot_report where stage='QUERY_INSIGHTS' and type='info' \


G

*************************** 1. row ***************************

log: {"comment": "Explain.", "query_id": 1, "query_text": "select flight_id , count(*) from booking group
by flight_id", "session_id": 60, "runtime_executed_ms": null, "runtime_estimated_ms": 269.173056}

*************************** 2. row ***************************

log: {"comment": "Explain.", "query_id": 2, "query_text": "select flight_id , count(*) from booking group
by flight_id", "session_id": 60, "runtime_executed_ms": null, "runtime_estimated_ms": 269.173056}

*************************** 3. row ***************************

log: {"comment": "Explain.", "query_id": 3, "query_text": "select flight_id , count(*) from booking group
by flight_id", "session_id": 60, "runtime_executed_ms": null, "runtime_estimated_ms": 269.173056}

*************************** 4. row ***************************

log: {"comment": "", "query_id": 4, "query_text": "select flight_id , count(*) from booking group by
flight_id", "session_id": 60, "runtime_executed_ms": 1248.9159107208252, "runtime_estimated_ms":
269.173056}

*************************** 5. row ***************************

log: {"comment": "Explain.", "query_id": 5, "query_text": "select count(*) from booking", "session_id":
60, "runtime_executed_ms": null, "runtime_estimated_ms": 0.552601}

*************************** 6. row ***************************

log: {"comment": "", "query_id": 6, "query_text": "select count(*) from booking", "session_id": 60,
"runtime_executed_ms": 24.508953094482425, "runtime_estimated_ms": 0.552601}

*************************** 7. row ***************************

log: {"comment": "Explain.", "query_id": 9, "query_text": "select station, weather, count(distinct


log_date) from weatherdata group by station, weather", "session_id": 60, "runtime_executed_ms":
null, "runtime_estimated_ms": 73.242269}

*************************** 8. row ***************************

log: {"comment": "", "query_id": 11, "query_text": "SELECT flight_id, COUNT(*), SUM(price) FROM
booking GROUP BY flight_id", "session_id": 60, "runtime_executed_ms": 773.9439010620117,
"runtime_estimated_ms": 530.405609}

*************************** 9. row ***************************


log: {"comment": "", "query_id": 13, "query_text": "SELECT airlinename 'Airline Name',
SUM(sold_seat)/SUM(capacity) 'Load Factor' FROM (SELECT flight_id, COUNT(*) sold_seat FROM
booking GROUP BY flight_id) seat_sold JOIN flight USING (flight_id) JOIN airplane USING (airplane_id)
JOIN airline ON airline.airline_id = flight.airline_id GROUP BY airlinename ORDER BY airlinename",
"session_id": 60, "runtime_executed_ms": 598.2420444488525, "runtime_estimated_ms": 293.621378}

*************************** 10. row ***************************

log: {"comment": "", "query_id": 14, "query_text": "SELECT airlinename 'Airline Name', YEAR(departure)
'Year', MONTH(departure) 'Month', SUM(sold_seat)/SUM(capacity) 'Load Factor' FROM (SELECT
flight_id, COUNT(*) sold_seat FROM booking GROUP BY flight_id) seat_sold JOIN flight USING
(flight_id) JOIN airplane USING (airplane_id) JOIN airline ON airline.airline_id = flight.airline_id
GROUP BY airlinename, YEAR(departure), MONTH(departure) ORDER BY airlinename, YEAR(departure),
MONTH(departure)", "session_id": 60, "runtime_executed_ms": 650.4650115966797,
"runtime_estimated_ms": 347.945846}

*************************** 11. row ***************************

log: {"comment": "", "query_id": 15, "query_text": "SELECT flightno 'Flight Number', FR.name 'Origin
Airport', DT.name 'Destination Airport', SUM(sold_seat)/SUM(capacity) 'Load Factor' FROM (SELECT
flight_id, COUNT(*) sold_seat FROM booking GROUP BY flight_id) seat_sold JOIN flight USING
(flight_id) JOIN airplane USING (airplane_id) JOIN airport FR ON flight.`from`=FR.airport_id JOIN
airport DT ON flight.`to`=DT.airport_id GROUP BY flightno, FR.name, DT.name ORDER BY flightno",
"session_id": 60, "runtime_executed_ms": 872.542142868042, "runtime_estimated_ms": 387.075508}

*************************** 12. row ***************************

log: {"comment": "", "query_id": 16, "query_text": "SELECT flightno 'Flight Number', FR.name 'Origin
Airport', DT.name 'Destination Airport', YEAR(flight.departure) 'Year', MONTH(flight.departure) 'Month',
SUM(sold_seat)/SUM(capacity) 'Load Factor' FROM (SELECT flight_id, COUNT(*) sold_seat FROM
booking GROUP BY flight_id) seat_sold JOIN flight USING (flight_id) JOIN airplane USING (airplane_id)
JOIN airport FR ON flight.`from`=FR.airport_id JOIN airport DT ON flight.`to`=DT.airport_id GROUP BY
flightno, FR.name, DT.name, YEAR(flight.departure), MONTH(flight.departure) ORDER BY flightno,
YEAR(flight.departure), MONTH(flight.departure)", "session_id": 60, "runtime_executed_ms":
902.616024017334, "runtime_estimated_ms": 422.002199}

12 rows in set (0.00 sec)


mysql> CALL sys.heatwave_advisor(JSON_OBJECT('auto_unload',JSON_OBJECT('mode','recommend')));

+-------------------------------+

| INITIALIZING HEATWAVE ADVISOR |

+-------------------------------+

| Version: 2.20 |

| |

| Output Mode: normal |

| Excluded Queries: 0 |

| Target Schemas: All |

| |

+-------------------------------+

6 rows in set (0.00 sec)

+---------------------------------------------------------+

| ANALYZING LOADED DATA |

+---------------------------------------------------------+

| Total 13 tables loaded in HeatWave for 1 schemas |

| |

| SCHEMA TABLES COLUMNS |

| NAME LOADED LOADED |

| ------ ------ ------ |


| `airportdb` 13 96 |

| |

+---------------------------------------------------------+

7 rows in set (0.03 sec)

+-----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------+

| HEATWAVE UNLOAD ADVISOR


|

+-----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------+

| Using:
|

| "last_queried_hours": 24
|

| "memory_gain_ascending": FALSE
|

| "limit_tables": 10
|

| Number of excluded tables: 0


|

|
|

| SCHEMA TABLE MEMORY


GAIN MEMORY GAIN |

| NAME NAME REASON


(HEATWAVE NODES) (HOST) |

| --------------- ------------------------- ---------------------------------------------


----------------------------- ------------------- |

| `airportdb` `airplane_type` NEVER QUERIED


8.00 MiB 0 bytes |

| `airportdb` `airport_geo` NEVER QUERIED


8.00 MiB 0 bytes |
| `airportdb` `employee` NEVER QUERIED
8.00 MiB 0 bytes |

| `airportdb` `flightschedule` NEVER QUERIED


8.00 MiB 0 bytes |

| `airportdb` `passenger` NEVER QUERIED


8.00 MiB 0 bytes |

| `airportdb` `passengerdetails` NEVER QUERIED


8.00 MiB 0 bytes |

| `airportdb` `airport_reachable` NEVER QUERIED


0 bytes 0 bytes |

| `airportdb` `flight_log` NEVER QUERIED 0


bytes 0 bytes |

+-----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------+

17 rows in set (0.03 sec)

+----------------------------------------------------------------------------------------------------------------+

| SCRIPT GENERATION |

+----------------------------------------------------------------------------------------------------------------+

| Script generated for applying suggestions for 8 loaded tables |

| |

| |

| Retrieve script containing 16 generated DDL commands using the query below: |

| Deprecation Notice: "heatwave_advisor_report" will be deprecated, please switch to


"heatwave_autopilot_report" |

| SELECT log->>"$.sql" AS "SQL Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| Caution: Executing the generated script will alter the column comment and secondary engine flags in
the schema |

| Caution: Executing the generated script will unload tables and queries will no longer be offloaded to
HeatWave |

| |
+----------------------------------------------------------------------------------------------------------------+

10 rows in set (0.04 sec)

Query OK, 0 rows affected (0.04 sec)

mysql> SELECT log->>"$.sql" AS "SQL Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"
ORDER BY id;

+--------------------------------------------------------------------+

| SQL Script |

+--------------------------------------------------------------------+

| ALTER TABLE `airportdb`.`airplane_type` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airplane_type` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airport_geo` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airport_geo` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`employee` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`employee` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`flight_log` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`flight_log` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`flightschedule` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`flightschedule` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`passenger` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`passenger` SECONDARY_ENGINE=NULL; |

| ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_UNLOAD; |

| ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_ENGINE=NULL; |

+--------------------------------------------------------------------+

16 rows in set (0.00 sec)


mysql> SELECT log->>"$.sql" AS "SQL Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"
ORDER BY id \G

*************************** 1. row ***************************

SQL Script: ALTER TABLE `airportdb`.`airplane_type` SECONDARY_UNLOAD;

*************************** 2. row ***************************

SQL Script: ALTER TABLE `airportdb`.`airplane_type` SECONDARY_ENGINE=NULL;

*************************** 3. row ***************************

SQL Script: ALTER TABLE `airportdb`.`airport_geo` SECONDARY_UNLOAD;

*************************** 4. row ***************************

SQL Script: ALTER TABLE `airportdb`.`airport_geo` SECONDARY_ENGINE=NULL;

*************************** 5. row ***************************

SQL Script: ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_UNLOAD;

*************************** 6. row ***************************

SQL Script: ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_ENGINE=NULL;

*************************** 7. row ***************************

SQL Script: ALTER TABLE `airportdb`.`employee` SECONDARY_UNLOAD;

*************************** 8. row ***************************

SQL Script: ALTER TABLE `airportdb`.`employee` SECONDARY_ENGINE=NULL;

*************************** 9. row ***************************

SQL Script: ALTER TABLE `airportdb`.`flight_log` SECONDARY_UNLOAD;

*************************** 10. row ***************************

SQL Script: ALTER TABLE `airportdb`.`flight_log` SECONDARY_ENGINE=NULL;

*************************** 11. row ***************************

SQL Script: ALTER TABLE `airportdb`.`flightschedule` SECONDARY_UNLOAD;

*************************** 12. row ***************************

SQL Script: ALTER TABLE `airportdb`.`flightschedule` SECONDARY_ENGINE=NULL;

*************************** 13. row ***************************

SQL Script: ALTER TABLE `airportdb`.`passenger` SECONDARY_UNLOAD;

*************************** 14. row ***************************


SQL Script: ALTER TABLE `airportdb`.`passenger` SECONDARY_ENGINE=NULL;

*************************** 15. row ***************************

SQL Script: ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_UNLOAD;

*************************** 16. row ***************************

SQL Script: ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_ENGINE=NULL;

16 rows in set (0.00 sec)

ALTER TABLE `airportdb`.`airplane_type` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`airplane_type` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`airport_geo` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`airport_geo` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`airport_reachable` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`employee` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`employee` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`flight_log` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`flight_log` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`flightschedule` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`flightschedule` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`passenger` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`passenger` SECONDARY_ENGINE=NULL;

ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`passengerdetails` SECONDARY_ENGINE=NULL;


mysql> CALL sys.heatwave_advisor(JSON_OBJECT('auto_enc',JSON_OBJECT('mode','recommend')));

+-------------------------------+

| INITIALIZING HEATWAVE ADVISOR |

+-------------------------------+

| Version: 2.20 |

| |

| Output Mode: normal |

| Excluded Queries: 0 |

| Target Schemas: All |

| |

+-------------------------------+

6 rows in set (0.01 sec)

+---------------------------------------------------------+
| ANALYZING LOADED DATA |

+---------------------------------------------------------+

| Total 5 tables loaded in HeatWave for 1 schemas |

| Tables excluded by user: 0 (within target schemas) |

| |

| SCHEMA TABLES COLUMNS |

| NAME LOADED LOADED |

| ------ ------ ------ |

| `airportdb` 5 25 |

| |

+---------------------------------------------------------+

8 rows in set (0.04 sec)

+------------------------------------------------------------------------------------------------------+

| ENCODING SUGGESTIONS |

+------------------------------------------------------------------------------------------------------+

| Total Auto Encoding suggestions produced for 2 columns |

| Queries executed: 12 |

| Total query execution time: 5.07 s |

| Most recent query executed on: Monday 1st April 2024 09:21:35 |

| Oldest query executed on: Monday 1st April 2024 08:58:36 |

| |

| CURRENT SUGGESTED |

| COLUMN COLUMN COLUMN |

| NAME ENCODING ENCODING |

| ------ -------- --------- |

| `airportdb`.`airline`.`airlinename` VARLEN DICTIONARY |

| `airportdb`.`airport`.`name` VARLEN DICTIONARY |

| |
| Applying the suggested encodings might improve cluster memory usage. Performance gains not
expected. |

| Estimated HeatWave cluster memory savings: 0 bytes |

| |

+------------------------------------------------------------------------------------------------------+

16 rows in set (0.60 sec)

+----------------------------------------------------------------------------------------------------------------+

| SCRIPT GENERATION |

+----------------------------------------------------------------------------------------------------------------+

| Script generated for applying suggestions for 2 loaded tables |

| |

| Applying changes will take approximately 2.00 s |

| |

| Retrieve script containing 12 generated DDL commands using the query below: |

| Deprecation Notice: "heatwave_advisor_report" will be deprecated, please switch to


"heatwave_autopilot_report" |

| SELECT log->>"$.sql" AS "SQL Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| Caution: Executing the generated script will alter the column comment and secondary engine flags in
the schema |

| |

+----------------------------------------------------------------------------------------------------------------+

10 rows in set (0.61 sec)

Query OK, 0 rows affected (0.61 sec)


ALTER TABLE `airportdb`.`airline` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`airline` SECONDARY_ENGINE=NULL;

SET SESSION innodb_parallel_read_threads = 1;

ALTER TABLE `airportdb`.`airline` MODIFY `airlinename` varchar(30) CHARACTER SET utf8mb4


COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '
RAPID_COLUMN_AUTODB=ENCODING=SORTED_4 RAPID_COLUMN=ENCODING=SORTED_4 ';

ALTER TABLE `airportdb`.`airline` SECONDARY_ENGINE=RAPID;

ALTER TABLE `airportdb`.`airline` SECONDARY_LOAD;

ALTER TABLE `airportdb`.`airport` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`airport` SECONDARY_ENGINE=NULL;

SET SESSION innodb_parallel_read_threads = 1;

ALTER TABLE `airportdb`.`airport` MODIFY `name` varchar(50) CHARACTER SET utf8mb4 COLLATE
utf8mb4_unicode_ci NOT NULL COMMENT ' RAPID_COLUMN_AUTODB=ENCODING=SORTED_4
RAPID_COLUMN=ENCODING=SORTED_4 ';

ALTER TABLE `airportdb`.`airport` SECONDARY_ENGINE=RAPID;

ALTER TABLE `airportdb`.`airport` SECONDARY_LOAD;


mysql> CALL sys.heatwave_advisor(JSON_OBJECT('target_schema',JSON_ARRAY('airportdb')));

+-------------------------------+

| INITIALIZING HEATWAVE ADVISOR |

+-------------------------------+

| Version: 2.20 |

| |

| Output Mode: normal |

| Excluded Queries: 0 |

| Target Schemas: 1 |

| |

+-------------------------------+

6 rows in set (0.01 sec)

+---------------------------------------------------------+

| ANALYZING LOADED DATA |

+---------------------------------------------------------+

| Total 5 tables loaded in HeatWave for 1 schemas |

| Tables excluded by user: 0 (within target schemas) |

| |

| SCHEMA TABLES COLUMNS |


| NAME LOADED LOADED |

| ------ ------ ------ |

| `airportdb` 5 25 |

| |

+---------------------------------------------------------+

8 rows in set (0.04 sec)

+-------------------------------------------------------------------+

| AUTO DATA PLACEMENT |

+-------------------------------------------------------------------+

| Auto Data Placement Configuration: |

| |

| Minimum benefit threshold: 1% |

| |

| Producing Data Placement suggestions for current setup: |

| |

| Tables Loaded: 5 |

| Queries used: 6 |

| Total query execution time: 5.05 s |

| Most recent query executed on: Monday 1st April 2024 09:21:35 |

| Oldest query executed on: Monday 1st April 2024 08:58:36 |

| HeatWave cluster size: 2 nodes |

| |

+-------------------------------------------------------------------+

13 rows in set (0.31 sec)

+-------------------------------------------------------------------------------------------------+

| DATA PLACEMENT SUGGESTIONS |

+-------------------------------------------------------------------------------------------------+
| Total Data Placement suggestions produced for 2 tables |

| |

| TABLE DATA PLACEMENT DATA PLACEMENT |

| NAME CURRENT KEY SUGGESTED KEY |

| ------ -------------- -------------- |

| `airportdb`.`booking` booking_id flight_id |

| `airportdb`.`flight` flight_id airplane_id |

| |

| Expected benefit after applying Data Placement suggestions |

| Runtime saving: 899.02 ms |

| Performance benefit: 17.7% |

| |

+-------------------------------------------------------------------------------------------------+

12 rows in set (0.32 sec)

+----------------------------------------------------------------------------------------------------------------+

| SCRIPT GENERATION |

+----------------------------------------------------------------------------------------------------------------+

| Script generated for applying suggestions for 2 loaded tables |

| |

| Applying changes will take approximately 47.00 s |

| |

| Retrieve script containing 12 generated DDL commands using the query below: |

| Deprecation Notice: "heatwave_advisor_report" will be deprecated, please switch to


"heatwave_autopilot_report" |

| SELECT log->>"$.sql" AS "SQL Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"


ORDER BY id; |

| |

| Caution: Executing the generated script will alter the column comment and secondary engine flags in
the schema |
| |

+----------------------------------------------------------------------------------------------------------------+

10 rows in set (0.33 sec)

Query OK, 0 rows affected (0.33 sec)

mysql> select group_concat(log->>'$.sql' separator ' ') as "SQL script" from


sys.heatwave_autopilot_report where type='sql' order by id \G

*************************** 1. row ***************************

SQL script: ALTER TABLE `airportdb`.`booking` SECONDARY_UNLOAD; ALTER TABLE `airportdb`.`booking`


SECONDARY_ENGINE=NULL; SET SESSION innodb_parallel_read_threads = 1; ALTER TABLE
`airportdb`.`booking` MODIFY `flight_id` int NOT NULL COMMENT
'RAPID_COLUMN=DATA_PLACEMENT_KEY=1'; ALTER TABLE `airportdb`.`booking`
SECONDARY_ENGINE=RAPID; ALTER TABLE `airportdb`.`booking` SECONDARY_LOAD; ALTER TABLE
`airportdb`.`flight` SECONDARY_UNLOAD; ALTER TABLE `airportdb`.`flight` SECONDARY_ENGINE=NULL;
SET SESSION innodb_parallel_read_threads = 1; ALTER TABLE `airportdb`.`flight` MODIFY `airplane_id`
int NOT NULL COMMENT 'RAPID_COLUMN=DATA_PLACEMENT_KEY=1'; ALTER TABLE `airportdb`.`flight`
SECONDARY_ENGINE=RAPID; ALTER TABLE `airportdb`.`flight` SECONDARY_LOAD;

1 row in set (0.00 sec)

ALTER TABLE `airportdb`.`booking` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`booking` SECONDARY_ENGINE=NULL;

SET SESSION innodb_parallel_read_threads = 1;


ALTER TABLE `airportdb`.`booking` MODIFY `flight_id` int NOT NULL COMMENT
'RAPID_COLUMN=DATA_PLACEMENT_KEY=1';

ALTER TABLE `airportdb`.`booking` SECONDARY_ENGINE=RAPID;

ALTER TABLE `airportdb`.`booking` SECONDARY_LOAD;

ALTER TABLE `airportdb`.`flight` SECONDARY_UNLOAD;

ALTER TABLE `airportdb`.`flight` SECONDARY_ENGINE=NULL;

SET SESSION innodb_parallel_read_threads = 1;

ALTER TABLE `airportdb`.`flight` MODIFY `airplane_id` int NOT NULL COMMENT


'RAPID_COLUMN=DATA_PLACEMENT_KEY=1';

ALTER TABLE `airportdb`.`flight` SECONDARY_ENGINE=RAPID;

ALTER TABLE `airportdb`.`flight` SECONDARY_LOAD;

You might also like