AI SQL Diagnosis and Optimization
AI SQL Diagnosis and Optimization analyzes the current SQL statement and returns diagnosis results, performance risks, and optimization suggestions. Use it to speed up query review before changing SQL or object design.
What It Does
- Analyzes SQL structure, access paths, and potential risks.
- Provides suggestions related to indexes, statement patterns, table design, execution behavior, and database-specific compatibility.
- Returns recommendations only. It does not directly modify or execute SQL.
Before you begin
- Open the SQL Console for the target data source in NineData.
- The current account has at least read-only permission on the target data source.
- Supported data sources include MySQL, Hive, DWS, Lindorm MySQL, Doris, TiDB, Vastbase, KingBaseES Oracle, TDSQL-C MySQL, TDSQL MySQL, PolarDB MySQL, PolarDB-X, PolarDB Oracle, SQL Server, PostgreSQL, Elasticsearch, OceanBase MySQL, OceanBase Oracle, Greenplum, StarRocks, MongoDB, DaMeng, GBase, Oracle, Sybase, AnalyticDB PostgreSQL, GreatSQL, Klustron, GoldenDB, MariaDB, KingBaseES, Db2, ClickHouse, GaussDB, SingleStore, SelectDB, and openGauss.
Procedure
- Open the SQL Console for the target data source. For more information, see SQL Console (RDBMS).
- Type, paste, or select the SQL you want to analyze.
- Place the cursor inside the target statement or select the entire statement.
- Click the SQL Optimize entry in the toolbar, or call the same feature from the right-click menu.
- Wait for the analysis to finish, then review the suggestions and adjust SQL or object design when required.
Typical Output Dimensions
| Dimension | Description |
|---|---|
| Current execution assessment | Helps evaluate cost, execution duration, and overall risk |
| Structure and constraints | Checks whether primary keys, unique constraints, or design choices need improvement |
| Indexes and access paths | Identifies full table scans, missing indexes, or weak index usage |
| SQL pattern improvements | Highlights issues such as SELECT *, unnecessary sorting, or inefficient filters |
| Long-term governance suggestions | Gives broader advice for maintainable schema and object design |
Result
NineData returns advisory optimization output. Confirm each suggestion with execution plans, business logic, data distribution, and change-management requirements before applying it in production.