SQL Editor lets you write, run, and manage SQL statements against your SelectDB instance directly in the browser. With SQL Editor, you can:
Select a target database and cluster, then run queries against live data
Browse query history and analyze execution plans and query profiles
Save and reuse query sessions
Run built-in SQL templates for common benchmark tests
Prerequisites
Before you begin, make sure you have:
A SelectDB instance at version 3.0.7 or later. See Create an instance.
Your machine's public IP address added to the webui_whitelist IP address whitelist of the instance. The console prompts you to do this the first time you open Data Development and Management. Click OK to acknowledge, then add the IP address. See Configure an IP address whitelist.
(For query profile access) The admin account and an instance running SelectDB Core 3.0 or later. Instances on SelectDB Core 4.0 or later support both online profile viewing and download. Instances on SelectDB Core 3.0 support download only.
Open SQL Editor
Log on to the SelectDB console.
In the top navigation bar, select the region where the instance resides.
In the left-side navigation pane, click Instances. On the Instances page, click the instance ID to go to the Instance Details page.
In the upper-right corner, click Data Development and Management and select SQL Editor from the drop-down list.
If this is your first time opening SQL Editor and you have not yet logged on to WebUI, the WebUI logon page appears. You can log on with the admin account. If you do not know or have forgotten the admin account password, reset it before proceeding.
Run a query
On the SQL Editor page, select the target database from the second drop-down list at the top of the right pane.
Select the target cluster from the third drop-down list.
Enter your SQL statement in the editor. For syntax reference, see SQL reference.
Click Run (Limit 1000).
View query history and profiles
In the left-side pane, click the Query History tab. Enter the SQL statement in the search box, then click a result to open its execution plan page.
From the execution plan page, you can:
View the query profile online and analyze execution details (requires SelectDB Core 4.0 or later and the admin account).
Download the profile for offline analysis (requires the admin account; available on SelectDB Core 3.0).
The query profile feature is enabled for all queries initiated on the SQL Editor page by default. This may slightly affect single-query performance.
Manage saved sessions
In the left-side pane, click the Saved Sessions tab. Enter session information in the search box to find a saved session and review its SQL statements.
Use benchmark SQL templates
In the left-side pane, click the Test Queries tab. Enter a keyword in the search box to find a SQL template, then open it to view or run it.
API reference
The following API operations are related to this feature: