Queries active SQL records.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| gpdb:DescribeActiveSQLRecords | get | *DBInstance acs:gpdb:*:{#accountId}:dbinstance/{#DBInstanceId} |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| DBInstanceId | string | Yes | The instance ID. Note
You can call the DescribeDBInstances operation to query the information about all AnalyticDB for PostgreSQL instances within a region, including instance IDs.
| gp-bp12ga6v69h86**** |
| Database | string | No | The name of the database. | testdb |
| User | string | No | The name of the database account. | testuser |
| StartTime | string | No | The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC. | 2021-08-03T09:30Z |
| EndTime | string | No | The end of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The end time must be later than the start time. | 2022-05-07T07:59Z |
| Keyword | string | No | The keyword used to filter queries. | SELECT |
| MinDuration | string | No | The minimum amount of time consumed by traces. Unit: milliseconds. | 300 |
| MaxDuration | string | No | The maxmum amount of time consumed by traces. Unit: milliseconds. | 600 |
| Order | string | No | The field used to sort lock diagnostics records and the sorting order. Default value: | {"Field":"StartTime","Type":"Desc"} |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "ABB39CC3-4488-4857-905D-2E4A051D0521",
"DBInstanceId": "gp-bp***************",
"Queries": [
{
"PID": 6164,
"SessionID": 6612,
"State": "running",
"QueryStart": "2022-05-07T06:59Z",
"QueryDuration": "60s",
"Query": "Select * from t1,t2 where t1.id=t2.id;",
"User": "testuser",
"Database": "xg_analyse",
"ClientAddr": "0.0.0.0",
"SqlTruncated": false,
"SqlTruncatedThreshold": 1024
}
]
}Error codes
For a list of error codes, visit the Service error codes.
