MySQL OCI Heatwave
MySQL OCI Heatwave
x_99052247@cloudshell:~ (us-ashburn-1)$ oci os object get -bn MYSQL_BUCKET --file setup.zip --name
setup6062.zip
x_99052247@cloudshell:~ (us-ashburn-1)$ ls
setup.zip
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';
Table: country
Table: country
Table: city
mysql> alter table city Modify CountryCode char(3) not null comment
'RAPID_COLUMN=DATA_PLACEMENT_KEY=1';
Table: city
+--------------------+
| Database |
+--------------------+
| airportdb |
| information_schema |
| mysql |
| mysql_audit |
| performance_schema |
| sys |
| world |
+--------------------+
+------------------------------------------+
+------------------------------------------+
| Version: 2.20 |
| |
| |
+------------------------------------------+
+--------------------------------------------------------------------------------------------------------+
| USAGE DOCUMENTATION |
+--------------------------------------------------------------------------------------------------------+
| Interface: |
| |
| Input Arguments: |
| // dryrun mode: Only generates load script (does not load the tables) |
| // normal mode (DEFAULT): Generates the load script and also loads data into HeatWave |
| // 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 |
| // valid string containing SQL_MODE (Session variable SQL_MODE is not used by Auto Load) |
| // Fully qualified names of tables and columns are expected without backticks |
| // Enabled by default. When enabled dynamically sets the load parallelism for each table |
| key: "external_tables" value_type: JSON_OBJECT for passing options to load external tables |
| |
| Output: |
| |
| Examples: |
| CALL sys.heatwave_load(JSON_ARRAY("db1"),NULL); |
| "disable_unsupported_columns","exclude_list",JSON_ARRAY("db1.tbl1","db2.tbl1.col1"))); |
+--------------------------------------------------------------------------------------------------------+
+------------------------------------------+
| INITIALIZING HEATWAVE AUTO PARALLEL LOAD |
+------------------------------------------+
| Version: 2.20 |
| |
| |
+------------------------------------------+
+-----------------------------------------------------------------------------------------------+
| OFFLOAD ANALYSIS |
+-----------------------------------------------------------------------------------------------+
| |
| |
| |
+-----------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------+
| CAPACITY ESTIMATION |
+-----------------------------------------------------------------------------------------------------------------------------+
| Default encoding for string columns: VARLEN (unless specified in the schema)
|
| |
| |
| |
+-----------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------+
| |
| Retrieve load script containing 43 generated DDL commands using the query below: |
| |
| Caution: Executing the generated load script will affect the secondary engine flags in the schema
|
| |
+-------------------------------------------------------------------------------------------------------------+
mysql> CALL
sys.heatwave_load(JSON_ARRAY('airportdb'),JSON_OBJECT('mode','dryrun','policy','not_disable_unsupp
orted_columns'));
+----------------------------------------------+
+----------------------------------------------+
| Version: 2.20 |
| |
| |
+----------------------------------------------+
+-----------------------------------------------------------------------------------------+
| OFFLOAD ANALYSIS |
+-----------------------------------------------------------------------------------------+
| |
| |
| |
+-----------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------+
| CAPACITY ESTIMATION |
+-----------------------------------------------------------------------------------------------------------------------------+
| Default encoding for string columns: VARLEN (unless specified in the schema)
|
| |
| |
+-----------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------+
| |
| Retrieve load script containing 39 generated DDL commands using the query below: |
| |
| |
| Caution: Executing the generated load script will affect the secondary engine flags in the schema
|
| |
+-------------------------------------------------------------------------------------------------------------+
+------------------------------------------+
+------------------------------------------+
| Version: 2.20 |
| |
| |
+------------------------------------------+
+-----------------------------------------------------------------------------------------------+
| OFFLOAD ANALYSIS |
+-----------------------------------------------------------------------------------------------+
| |
| |
| |
+-----------------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------+
| CAPACITY ESTIMATION |
+-----------------------------------------------------------------------------------------------------------------------------+
| Default encoding for string columns: VARLEN (unless specified in the schema)
|
| |
| |
| |
+-----------------------------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------------------------------------+
| EXECUTING LOAD |
+---------------------------------------------------------------------------------------------------------------------------------------+
| Retrieve load script containing 43 generated DDL command(s) using the query below:
|
| |
| |
| 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 |
| |
| |
| |
+---------------------------------------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------+
| LOAD SUMMARY |
+-------------------------------------------------------------------------------+
| |
| |
+-------------------------------------------------------------------------------+
-> sys.heatwave_autopilot_report
-> where type='sql'
-> order by id \g
+-----------------------------------------------------------------------------------------------------+
| Load script |
+-----------------------------------------------------------------------------------------------------+
| ALTER TABLE `airportdb`.`airport_geo` MODIFY `geolocation` point NOT NULL COMMENT '' NOT
SECONDARY; |
+-----------------------------------------------------------------------------------------------------+
+----------------+
| variable_value |
+----------------+
| 100.000000 |
+----------------+
+-----------------------------+---------------+
| 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 |
+-----------------------------+---------------+
+-----------------------------+---------------------+
| 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 |
+-----------------------------+---------------------+
+-----------------------------+-------------------------------+
| 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)
Table: city
+-----------------------------------------------------------------------------------------------------------------------------------------
+
| USAGE DOCUMENTATION |
+-----------------------------------------------------------------------------------------------------------------------------------------
+
| Interface: |
| |
| Input Arguments: |
| // dryrun mode: only produces the report without actually unloading the tables.
|
| // normal mode (DEFAULT): unloads the schemas from Heatwave and produces an unload report.
|
| // normal output (DEFAULT): Produces detailed output on stdout in addition to temp table.
|
| // silent output: Only produces temp table output. Useful for scripting.
|
| Output: |
| |
| Examples: |
| 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" |
| ) |
| ); |
+-----------------------------------------------------------------------------------------------------------------------------------------
+
+-----------------------------------+
+-----------------------------------+
| |
| |
| Unload exclude_list: [] |
| |
+-----------------------------------+
+--------------------------------------------------------------------------------------------------------------+
| HEATWAVE UNLOAD |
+--------------------------------------------------------------------------------------------------------------+
| |
| |
| |
| |
| |
+--------------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------------+
| EXECUTING UNLOAD |
+---------------------------------------------------------------------------------------------------------------+
| HeatWave Unload script generated |
| Retrieve unload script containing 2 generated DDL commands using the query below: |
| |
| |
| |
+---------------------------------------------------------------------------------------------------------------+
+----------------------------------------+
| UNLOAD EXECUTE |
+----------------------------------------+
| Warnings encountered: 0 |
+----------------------------------------+
mysql> select log->> "$.sql" AS "UnLoad script" from sys.heatwave_autopilot_report where type='sql'
order by id;
+------------------------------------------------------+
| UnLoad script |
+------------------------------------------------------+
+------------------------------------------------------+
2 rows in set (0.00 sec)
+-----------------------------------+
+-----------------------------------+
| |
| |
| Unload exclude_list: [] |
| |
+-----------------------------------+
+--------------------------------------------------------------------------------------------------------------+
| HEATWAVE UNLOAD |
+--------------------------------------------------------------------------------------------------------------+
| |
| |
| |
| |
| |
+--------------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------------+
| Retrieve unload script containing 28 generated DDL commands using the query below:
|
| |
| |
| 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
|
| |
+---------------------------------------------------------------------------------------------------------------+
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; |
+--------------------------------------------------------------------+
28 rows in set (0.00 sec)
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
Heatwave Not Used: [{"cost": 10330.1, "reason": "The estimated query cost does not exceed
secondary_engine_cost_threshold.", "threshold": 100000}]
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
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
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
mysql> explain select flightno , timediff(arrival, departure) from flight join booking using (flight_id) \G
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
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
query: explain select flightno , timediff(arrival, departure) from flight join booking using (flight_id)
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.
mysql> explain select station, weather, count(distinct log_date) from weatherdata group by station,
weather\G
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
query: explain select station, weather, count(distinct log_date) from weatherdata group by
station, weather
+-------------------------------+
| INITIALIZING HEATWAVE ADVISOR |
+-------------------------------+
| Version: 2.20 |
| |
| Excluded Queries: 0 |
| |
+-------------------------------+
+---------------------------------------------------------+
+---------------------------------------------------------+
| |
| `airportdb` 13 96 |
| |
+---------------------------------------------------------+
+--------------------------------------------------------------------------------------------------------------------+
| QUERY INSIGHTS |
+--------------------------------------------------------------------------------------------------------------------+
| |
| 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. |
| 9 60 select station, weather, count(distinct log_date) from weat... 0.073 (est.) Explain. |
| |
| |
| |
| |
+--------------------------------------------------------------------------------------------------------------------+
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}
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}
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}
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}
log: {"comment": "Explain.", "query_id": 5, "query_text": "select count(*) from booking", "session_id":
60, "runtime_executed_ms": null, "runtime_estimated_ms": 0.552601}
log: {"comment": "", "query_id": 6, "query_text": "select count(*) from booking", "session_id": 60,
"runtime_executed_ms": 24.508953094482425, "runtime_estimated_ms": 0.552601}
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}
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}
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}
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}
+-------------------------------+
+-------------------------------+
| Version: 2.20 |
| |
| Excluded Queries: 0 |
| |
+-------------------------------+
+---------------------------------------------------------+
+---------------------------------------------------------+
| |
| |
+---------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------+
| Using:
|
| "last_queried_hours": 24
|
| "memory_gain_ascending": FALSE
|
| "limit_tables": 10
|
|
|
+-----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------+
| SCRIPT GENERATION |
+----------------------------------------------------------------------------------------------------------------+
| |
| |
| Retrieve script containing 16 generated DDL commands using the query below: |
| |
| 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 |
| |
+----------------------------------------------------------------------------------------------------------------+
mysql> SELECT log->>"$.sql" AS "SQL Script" FROM sys.heatwave_autopilot_report WHERE type = "sql"
ORDER BY id;
+--------------------------------------------------------------------+
| SQL Script |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
+-------------------------------+
+-------------------------------+
| Version: 2.20 |
| |
| Excluded Queries: 0 |
| |
+-------------------------------+
+---------------------------------------------------------+
| ANALYZING LOADED DATA |
+---------------------------------------------------------+
| |
| `airportdb` 5 25 |
| |
+---------------------------------------------------------+
+------------------------------------------------------------------------------------------------------+
| ENCODING SUGGESTIONS |
+------------------------------------------------------------------------------------------------------+
| Queries executed: 12 |
| Most recent query executed on: Monday 1st April 2024 09:21:35 |
| |
| CURRENT SUGGESTED |
| |
| Applying the suggested encodings might improve cluster memory usage. Performance gains not
expected. |
| |
+------------------------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------+
| SCRIPT GENERATION |
+----------------------------------------------------------------------------------------------------------------+
| |
| |
| Retrieve script containing 12 generated DDL commands using the query below: |
| |
| Caution: Executing the generated script will alter the column comment and secondary engine flags in
the schema |
| |
+----------------------------------------------------------------------------------------------------------------+
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 ';
+-------------------------------+
+-------------------------------+
| Version: 2.20 |
| |
| Excluded Queries: 0 |
| Target Schemas: 1 |
| |
+-------------------------------+
+---------------------------------------------------------+
+---------------------------------------------------------+
| |
| `airportdb` 5 25 |
| |
+---------------------------------------------------------+
+-------------------------------------------------------------------+
+-------------------------------------------------------------------+
| |
| |
| |
| Tables Loaded: 5 |
| Queries used: 6 |
| Most recent query executed on: Monday 1st April 2024 09:21:35 |
| |
+-------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------+
| Total Data Placement suggestions produced for 2 tables |
| |
| |
| |
+-------------------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------+
| SCRIPT GENERATION |
+----------------------------------------------------------------------------------------------------------------+
| |
| |
| Retrieve script containing 12 generated DDL commands using the query below: |
| |
| Caution: Executing the generated script will alter the column comment and secondary engine flags in
the schema |
| |
+----------------------------------------------------------------------------------------------------------------+