Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ SQL Throttling/ Modifying a SQL Throttling Task
Updated on 2025-08-19 GMT+08:00

Modifying a SQL Throttling Task

Function

This API is used to modify a SQL throttling task based on the specific scope and type. Before calling this API:

URI

PUT /v3/{project_id}/instances/{instance_id}/limit-task/{task_id}

Table 1 Parameter description

Name

Mandatory

Description

project_id

Yes

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value can contain 36 characters. Only letters and digits are allowed.

Default Value

N/A

task_id

Yes

Definition

Throttling task ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

You can obtain the token by calling the IAM API used to obtain a user token.

After the request is processed, the value of X-Subject-Token in the message header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn
  • en-us

Default Value

en-us

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

start_time

No

String

Definition

Task start time.

Constraints

This parameter is mandatory when task_scope is set to SQL.

The format must be yyyy-mm-ddThh:mm:ss+0000.

Range

Any time greater than or equal to the current time (UTC) minus two minutes

Default Value

N/A

end_time

No

String

Definition

Task end time.

Constraints

This parameter is mandatory when task_scope is set to SQL.

The format must be yyyy-mm-ddThh:mm:ss+0000.

Range

The time must be later than the task start time.

Default Value

N/A

key_words

No

String

Definition

Keywords.

Constraints

This parameter is mandatory when limit_type is set to SQL_TYPE.

Range

You can enter 2 to 100 keywords and separate multiple keywords by commas (,). Each keyword can contain 2 to 64 characters and cannot start and end with a space. The specifical characters ("\{}) and null are not allowed.

Default Value

N/A

task_name

No

String

Definition

Throttling task name.

Constraints

N/A

Range

The value can contain up to 100 characters. Only letters, underscores (_), digits, and dollar signs ($) are allowed.

Default Value

N/A

parallel_size

No

Integer

Definition

Maximum concurrency.

Constraints

An integer greater than or equal to 0.

Range

[0, 2147483647]

Default Value

N/A

cpu_utilization

No

Integer

Definition

CPU usage threshold.

Constraints

This parameter is mandatory when limit_type is set to SESSION_ACTIVE_MAX_COUNT.

This parameter and memory_utilization cannot be both set to 0. If you only need one of them for throttling, set the other threshold to 0.

Range

The value is an integer in the range [0,100).

Default Value

N/A

memory_utilization

No

Integer

Definition

Memory usage threshold.

Constraints

This parameter is mandatory when limit_type is set to SESSION_ACTIVE_MAX_COUNT.

This parameter and cpu_utilization cannot be both set to 0. If you only need one of them for throttling, set the other threshold to 0.

Range

The value is an integer in the range [0,100).

Default Value

N/A

databases

No

String

Definition

Databases of the instance. Databases are separated by commas (,).

Constraints

This parameter is mandatory when limit_type is set to SQL_TYPE.

Range

N/A

Default Value

N/A

Response Parameters

Table 4 Response body parameters

Parameter

Type

Description

task_id

String

Definition

Throttling task ID.

Range

N/A

databases

String

Definition

Databases of the instance. Databases are separated by commas (,).

Range

N/A

task_name

String

Definition

Throttling task name.

Range

N/A

key_words

String

Definition

Keyword. This parameter is returned only when the task type is SQL_TYPE.

Range

N/A

parallel_size

Integer

Definition

Maximum concurrency.

Range

[0,2147483647]

cpu_utilization

Integer

Definition

CPU usage threshold. This parameter is returned with only its integer part retained when the task type is SESSION_ACTIVE_MAX_COUNT.

Range

[0,100)

memory_utilization

Integer

Definition

Memory usage threshold. This parameter is returned with only its integer part retained when the task type is SESSION_ACTIVE_MAX_COUNT.

Range

[0,100)

start_time

String

Definition

Start time of the throttling task. The format is yyyy-mm-ddThh:mm:ssZ. This parameter is returned when task_scope is set to SQL.

Range

N/A

end_time

String

Definition

End time of the throttling task. The format is yyyy-mm-ddThh:mm:ssZ. This parameter is returned when task_scope is set to SQL.

Range

N/A

rule_name

String

Definition

Rule name.

Range

N/A

job_id

String

Definition

Job ID.

Range

N/A

Example Request

  • Modifying a throttling task whose type is SQL_ID
    https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/3d39c18788b54a919bab633874c159dfin14/limit-task/96854ba7-8d50-4a3c-8fd8-210a7390e9d1
    {
      "start_time" : "2024-08-20T06:54:42+0800",
      "end_time" : "2024-08-20T07:54:42+0800",
      "task_name" : "SOLIdLimit",
      "parallel_size" : 10
    }
  • Modifying a throttling task whose type is SQL_TYPE
    https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/3d39c18788b54a919bab633874c159dfin14/limit-task/96854ba7-8d50-4a3c-8fd8-210a7390e9d1
    {
      "start_time" : "2024-08-20T06:54:42+0800",
      "end_time" : "2024-08-20T07:54:42+0800",
      "key_words" : "version,type",
      "task_name" : "KeywordLimit",
      "parallel_size" : 10,
      "databases" : "gaussdb_test3"
    }
  • Modifying a throttling task whose type is SESSION_ACTIVE_MAX_COUNT
    https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0611f1bd8b00d5d32f17c017f15b599f/instances/3d39c18788b54a919bab633874c159dfin14/limit-task/96854ba7-8d50-4a3c-8fd8-210a7390e9d1
    {
      "task_name": "ThresholdLimit",
      "parallel_size": 10,
      "cpu_utilization": 20,
      "memory_utilization": 20
    }

Example Response

  • Throttling task whose type is SQL_ID modified.
    {
        "task_id": "bca08a79-8557-42c2-ab73-09a14d178c57",
        "task_name": "SOLIdLimit",
        "parallel_size": 10,
        "start_time": "2024-08-19T22:54:42Z",
        "end_time": "2024-08-19T23:54:42Z",
        "job_id": "d44bbbc3-4465-4079-ac71-d8e7ab0643a4"
    }
  • Throttling task whose type is SQL_TYPE modified.
    {
        "task_id": "ef8575c7-0133-43b4-8ab2-b950b9a6daaf",
        "databases": "gaussdb_test3",
        "task_name": "KeywordLimit",
        "key_words": "type,version",
        "parallel_size": 10,
        "start_time": "2024-08-19T22:54:42Z",
        "end_time": "2024-08-19T23:54:42Z",
        "job_id": "40e2e10f-6f4c-4883-9db7-5422f42187cc"
    }
  • Throttling task whose type is SESSION_ACTIVE_MAX_COUNT modified.
    {
        "task_id": "37b6232c-58ea-4d62-a5b5-54fc215c2115",
        "task_name": "ThresholdLimit",
        "parallel_size": 10,
        "cpu_utilization": 20,
        "memory_utilization": 20,
        "job_id": "0ec7109d-bc8f-41f6-9a78-a70f966739fc"
    }

Status Codes

Error Codes

For details, see Error Codes.