AnalyticDB for MySQL provides a built-in SQL editor for SQL development directly in the console.
Usage notes
-
SQL development requires a privileged database account.
-
If you use a RAM user to log on to AnalyticDB for MySQL, associate the RAM user with a database account in AnalyticDB for MySQL. Associate or disassociate a RAM user with a database account.
Access the SQL editor
-
Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster that you want to manage and click the cluster ID.
-
In the left-side navigation pane, choose Job Development > SQL Development.
Load a built-in dataset
If you skipped the built-in dataset when creating your AnalyticDB for MySQL cluster, load it later for quick testing. On the SQL Development page, click Load Built-in Dataset and click OK.
View database and table structure
On the Databases and Tables tab of the SQL Development page, you can view the INFORMATION_SCHEMA system database, and all databases and tables, including those synchronized to AnalyticDB for MySQL through real-time data ingestion. Use the drop-down list to switch databases.
Select an engine and a resource group
The engine and resource group determine the SQL execution method.
|
Engine |
Resource group |
Supported SQL |
Submission method |
Execution mode |
|
Spark |
Job resource group |
Spark SQL |
Serial execution. |
Batch mode. |
|
Interactive resource group |
Spark SQL |
Serial execution or parallel execution. |
Interactive mode. |
|
|
XIHE |
Job resource group |
XIHE BSP SQL |
Serial execution or parallel execution. |
Batch mode. |
|
Interactive resource group |
XIHE MPP SQL |
Serial execution or parallel execution. |
Interactive mode. |
-
Serial execution: Multiple SQL statements are submitted to the engine sequentially.
-
Parallel execution: Multiple SQL statements are submitted to the engine concurrently.
-
XIHE BSP SQL and XIHE MPP SQL do not support writing data to Hudi tables.
View and export query results
After an SQL statement runs, the Execution Results tab shows query results or errors. The Execution Records tab shows execution details such as status, resource group, database account, and duration.
You can export XIHE BSP SQL query results to a local file.
Set the number of exported rows: Click ... next to Execute(F8)(LIMIT 1000) to set the export row count. If the SQL LIMIT value differs from the console limit, the smaller value applies.
Export query results: On the Execution Results tab, click Download in the upper-right corner to export results.
Save SQL scripts
Save SQL statements as scripts from the editor. View saved scripts on the Scripts tab.
Query diagnostics
XIHE BSP SQL and XIHE MPP SQL support SQL diagnostics. On the Execution Records tab, click Diagnose to diagnose the query execution plan. SQL diagnostics.
Spark SQL also supports diagnostics. On the Execution Records tab, click Diagnose to diagnose the query execution plan. Spark SQL diagnostics.
View Spark logs
After a Spark SQL statement runs, click Logs on the Execution Records tab to view Spark logs.
Access the Spark web UI
After a Spark SQL statement runs, click UI on the Execution Records tab to open the Spark web UI and view Spark job status.