2 Create an Optimization
Description: Create an optimization task using an existing workspace ID (workspaceId) or DDL statements and SQL statements to be optimized, and return the optimization result status and corresponding optimization result ID (analysisId).
2.1. Interface URL
Post http://${server-host}:${server-port}/api/v1/createAnalysis
2.2. Request Parameters
Field | Type | Required | Description |
---|---|---|---|
userKey | String | Y | Activation code |
workspace | String | Y | Created workspace ID or DDL text corresponding to the workspace |
dbType | String | N | Required when workspace is ddl, default mysql if not filled |
workload | String | Y | SQL to be optimized |
queryMode | String | Y | Type of SQL to be optimized plain_sql / mysql_query_log / postgresql_query_log |
validateFlag | boolean | N | Whether to perform validate operation when executing analysis (only takes effect when the workspaceId corresponds to an online workspace), default false |
Request Example
{
"userKey": "CB698418-88B25371-67F15F01-XXXXXXXX",
"workspace": "CREATE TABLE `organization` (`org_id` bigint(20) NOT NULL)",
"dbType": "mysql",
"workload": "select * from organization where adm_id = 100 and adm_name = null;",
"queryMode": "plain_sql",
"validateFlag": false
}
2.3. Response
Field | Type | Description |
---|---|---|
code | int | Status code |
message | String | Description |
data | Object | Data |
Data structure of data
Field | Type | Description |
---|---|---|
analysisId | String | Optimization ID |
status | String | Optimization status |
Response Example
- Success
{
"code": 200,
"message": "Success",
"data": {
"analysisId": "1730505660018876418",
"status": "success"
}
}
- Failure
{
"code": 400,
"message": "Analysis creation failed",
"data": null
}