SQL editor
The SQL editor is a visual tool for writing, executing, and managing SQL statements. It simplifies database management, improving your efficiency and data accuracy. This topic describes how to use the SQL editor in ApsaraDB for SelectDB.
Prerequisites
You have created a ApsaraDB for SelectDB instance. For more information, see Create an instance.
The instance is version 3.0.7 or later.
Procedure
Log on to the SelectDB console.
In the upper-left corner of the page, select the instance's region.
On the Instances page, click the target Instance ID to open the Instance Details page.
In the upper-right corner of the page, click Data Development and Management.
NoteThe first time you use Data Development and Management, a dialog box appears, prompting you to add your local public IP address to the webui_whitelist group of the instance's IP address whitelist. Read the prompt and click OK.
From the drop-down list, click SQL Editor.
NoteThe first time you use the SQL Editor, if you are not logged in to the WebUI, you are redirected to its login page.
Use the admin account to log in to the WebUI.
If you forget the password for the admin account, you can reset it. For more information, see Reset an account password.
On the SQL Editor page, you can perform the following operations.
Execute SQL statements:
In the second drop-down list at the top of the page, select the database to use.
In the third drop-down list, select the cluster to use, and then enter your SQL statements in the editor. For more information about SQL syntax, see SQL reference.
Click Run (Limit 1000).
View execution history: In the upper-left menu bar, click Query History. In the search box, enter the target SQL statement. Click a statement to open its execution plan page, where you can perform the following operations:
ImportantWhen you use this feature, note the following:
You must log in with the admin account.
Instances of version 4.0 or later support viewing and downloading the query profile online. Instances of version 3.0 only support downloading the query profile.
View the query profile online to analyze the statement's execution.
Download the query profile file.
NoteBy default, the query profile feature is enabled for all queries initiated on the SQL Editor page. This may slightly affect query performance.
View saved sessions: In the upper-left menu bar, click Saved Sessions. In the search box, enter the target session information.
View and use benchmark test queries: In the upper-left menu bar, click Test Queries. In the search box, enter the name of the query.
Limits
The Web UI SQL Editor does not support MySQL’s \G vertical output, as it is a CLI-specific command, not standard SQL. Please use the MySQL CLI to view results in this format.