All Products
Search
Document Center

AnalyticDB for PostgreSQL:DownloadSQLLogsRecords

Last Updated:May 09, 2024

Download the slow query logs of an AnalyticDB for PostgreSQL instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is 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.
OperationAccess levelResource typeCondition keyAssociated operation
gpdb:DownloadSQLLogsRecordsRead
  • DBInstance
    acs:gpdb:*:{#accountId}:dbinstance/{#dbinstanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBInstanceIdstringYes

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****
QueryKeywordsstringNo

The keywords that are used for query.

select 1
StartTimestringYes

The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

2023-05-07T06:59Z
DatabasestringNo

The name of the database.

testdb
UserstringNo

The name of the database account.

testuser
EndTimestringYes

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.

2023-05-08T06:59Z
PageSizeintegerNo

The number of entries per page. Valid values:

  • 30
  • 50
  • 100

Default value: 30.

30
PageNumberintegerNo

The page number. Pages start from page 1. Default value: 1.

1
ExecuteCoststringNo

The execution duration of the SQL statement. Unit: seconds.

1
SourceIPstringNo

The source IP address.

100.XX.XX.90
ExecuteStatestringNo

The execution status of the SQL statement.

  • 1: successful.
  • 0: failed.
1
OperationClassstringNo

The type of the query language. Example: DQL, DML, or DDL.

DQL
OperationTypestringNo

The type of the SQL statement. Example: SELECT.

SELECT
MaxExecuteCoststringNo

The maximum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.

999
MinExecuteCoststringNo

The minimum amount of time consumed by a slow query. Unit: seconds. Minimum value: 0.

1
LangstringNo

The language of the file that contains the query diagnostic information. Valid values:

  • zh: simplified Chinese.
  • en: English.
  • ja: Japanese.
  • zh-tw: traditional Chinese.
zh

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

7565770E-7C45-462D-BA4A-8A5396F2CAD1
DownloadIdlong

The ID of the download task.

11

Examples

Sample success responses

JSONformat

{
  "RequestId": "7565770E-7C45-462D-BA4A-8A5396F2CAD1",
  "DownloadId": 11
}

Error codes

For a list of error codes, visit the Service error codes.