The SQL console provides AI capabilities to assist users in better SQL development.
Background information
The SQL console integrates AI capabilities to help you query knowledge about OceanBase Database and SQL development techniques. It also supports intelligent processing of SQL statements, such as SQL generation, rewriting, error correction, and formatting. The SQL console provides a shortcut dialog box on the SQL editing page and an independent dialog box to help you quickly develop SQL statements.
Prerequisites
The AI service is enabled in the AI settings. For more information, see Enable the AI service.
AI-assisted SQL editing
In the SQL editing area, you can invoke the AI assistant in the following ways:
Select the content to be edited, and click Edit on the right to open the AI assistant dialog box.
Select the content to be edited, right-click the selected content, and choose AI Assistant, SQL Intelligent Correction, SQL Intelligent Optimization, or Intelligent Formatting from the shortcut menu. You can also choose Intelligent Formatting to format the selected content.
Press
CTRL + K/COMMAND + Kto quickly invoke the AI assistant dialog box.
In the AI assistant dialog box, enter the instruction, and view the output result. You can choose to keep or discard the result.
SQL generation
SQL correction
SQL rewriting
SQL optimization
Intelligent code completion
Enable the intelligent code completion feature in the toolbar.
Then, during SQL development, a short delay will show intelligent recommendations. You can click
Acceptor press the Tab key to insert the recommended content.
Developer Assistant
In the SQL console, you can invoke the Developer Assistant as follows:
In the upper-right corner of the interface, click the Development Assistant icon.
In the SQL editing area, select the target content and click Add to the conversation on the right to quickly copy the content to the Developer Assistant.
In the SQL editing area, select the target content and press the shortcut key
CTRL + L/COMMAND + Lto quickly copy the content to the Developer Assistant.
The Developer Assistant also supports SQL generation, SQL error correction, SQL rewriting, SQL formatting, and SQL optimization. Additionally, SQL content returned by the Developer Assistant can be quickly referenced in the SQL editing page.
Error Interpretation
During intelligent SQL development, one of the most common features is the interpretation of SQL execution errors.
You can quickly view the reason for SQL execution errors as follows:
On the execution records page, click the Intelligent Interpretation button in the result column to quickly invoke the Developer Assistant and automatically fill in the error description.
On the log page, you can also click the Intelligent Interpretation button to quickly invoke the Developer Assistant and automatically fill in the error description.
Analyze the execution profile
After the SQL statement is successfully executed, you can analyze the execution details and execution plan of the SQL statement by using the execution profile.
Execution details
Execution plan
