Skip to main content
POST
Error

Authorizations

userKey
string
header
required

Activation code, obtained via the /getUserKey endpoint

Body

application/json

Create optimization task request

userKey
string
required

Activation code

Example:

"CB698418-88B25371-67F15F01-XXXXXXXX"

workspace
string
required

Workspace ID or DDL text (an offline workspace is auto-created when DDL is passed)

workload
string
required

SQL text to optimize

queryMode
enum<string>
required

SQL type: plain_sql / mysql_query_log / postgresql_query_log

Available options:
plain_sql,
mysql_query_log,
postgresql_query_log
Example:

"plain_sql"

dbType
string

Database type (displayCode); required when workspace is DDL, default mysql. See the dbType table in the /createWorkspace endpoint for supported values.

validateFlag
boolean
default:false

Whether to run validate checks (only effective for online workspaces), default false

singleQueryFlag
boolean

Whether to validate as a single SQL statement only

analysisName
string

Optimization task name; auto-generated when omitted

analyzeFlag
boolean

Whether to run analysis

closeRewrite
boolean

Whether to disable query rewriting

deduplicateFlag
boolean

Whether to deduplicate indexes

updateStatsBeforeValidationFlag
boolean

Whether to update statistics before validation

indexOnly
boolean

Whether to recommend indexes only (no rewriting)

maxMembers
integer

Maximum number of columns in a composite index

maxMembersForIndexOnly
integer

Maximum number of columns in a composite index in index-only mode

maxPerTable
integer

Maximum number of recommended indexes per table

maxSpace
integer

Maximum index space multiplier

rules
object[]

Custom rule list; the default audit rules are used when omitted

Response

200 - application/json

Asynchronous optimization task creation result

Unified response body

code
integer

Status code, 200 indicates success

Example:

200

message
string

Description message

Example:

"Success"

data
object

Create optimization task response