Querying SQL Statement Statistics (RDS for PostgreSQL)
Function
This API is used to query SQL statement statistics of a DB instance.
- Before calling this API, learn how to authenticate it.
- Before calling this API, learn about request header parameters.
URI
- Parameter description
Table 1 Parameters Parameter
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
N/A
Default Value
N/A
instance_id
Yes
Definition
Instance ID.
Constraints
N/A
Range
N/A
Default Value
N/A
Request
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
offset |
No |
Integer |
Definition Index offset. The query starts from the next piece of data indexed by this parameter. Constraints The value must be a non-negative number. Range An integer greater than or equal to 0 Default Value 0 |
|
limit |
No |
Integer |
Definition Number of records returned by a query. Constraints N/A Range The default value is 1000. The value cannot be a negative number. The minimum value is 1, and the maximum value is 1000. Default Value 1000 |
Example Request
Query SQL statement statistics.
GET https://{Endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/794c38e5309344818f4b33b86ebce9b4in03/sql-statistics
Response
- Normal response
Table 3 Parameters Parameter
Type
Description
reset_view_last_time
Long
Definition
Last reset time.
Range
N/A
total_count
Integer
Definition
Total number of records in the SQL statistics list.
Range
N/A
schemas
Array of objects
Definition
Calling result. For details, see Table 4.
Table 4 schemas field description Parameter
Type
Description
user_name
String
Definition
Username.
Range
N/A
database
String
Definition
Database name.
Range
N/A
query_id
String
Definition
Internal hash code calculated by the SQL parse tree.
Range
N/A
calls
Long
Definition
Number of calls.
Range
N/A
query
String
Definition
Text format of an SQL statement.
Range
N/A
rows
Long
Definition
Scanned rows.
Range
N/A
can_use
double
Definition
Whether SQL throttling can be applied.
Range
N/A
- Example normal response
{ "reset_view_last_time": 1561561651651, "total_count": 1, "list": [ { "user_name": "root", "database": "data_test", "query_id": "4454541510", "calls": 1111, "query": "select pg_sleep(222);", "rows": 111, "can_use": true } ] }
- Abnormal response
For details, see Abnormal Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot