El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Scalable File Service Turbo
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Data Admin Service/ API Reference/ APIs (in OBT)/ Cloud DBA/ Exporting the Top SQL Template List

Exporting the Top SQL Template List

Updated on 2024-12-04 GMT+08:00

Function

This API is used to export the Top SQL template list after Top SQL is enabled. This function is available only for paid instances. The maximum query interval is one hour.

URI

GET /v3/{project_id}/instances/{instance_id}/top-sql-templates

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

start_at

Yes

Long

Start time in Unix timestamp format, in milliseconds.

end_at

Yes

Long

End time in Unix timestamp format, in milliseconds.

datastore_type

Yes

String

Database type, which can be MySQL and TaurusDB

node_id

No

String

Node ID

sort

No

String

Sorting field (executeNum: execution times; totalCost: total duration; avgCost: average duration; totalScan: scanned rows; avgScan: average scanned rows).

Default value: avgCost

Enumerated values:

  • executeNum
  • totalCost
  • avgCost
  • totalScan
  • avgScan

asc

No

Boolean

Sorting sequence. true indicates ascending order and false indicates descending order.

Default value: false

offset

No

Integer

Offset. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value must be a number but cannot be a negative number.

limit

No

Integer

Number of records displayed on each page. The default value is 20 and the maximum value is 100.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

X-Language

No

String

Request language type.

Enumerated values:

  • en-us
  • zh-cn

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

top_sql_templates

Array of TopSqlTemplate objects

SQL templates.

total_count

Integer

Total number of SQL templates

Table 5 TopSqlTemplate

Parameter

Type

Description

sql_template

String

SQL templates.

sql_sample_string

String

Example SQL.

sql_type

String

SQL type.

db_name

String

Database name.

execute_num

Long

Total executions.

total_cost

Double

Total duration (ms).

avg_cost

Double

Average duration (ms).

avg_rows_sent

Double

Avg. rows returned.

avg_rows_affected

Double

Avg. rows affected.

avg_lock_time

Double

Avg. lock wait time (ms).

total_rows_examined

Double

Total scanned rows.

avg_rows_examined

Double

Avg. rows scanned.

total_cost_ratio

String

Total duration (%).

total_examined_ratio

String

Scanned rows (%).

execute_num_ratio

String

Execution times (%).

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 8 characters

Maximum length: 36 characters

error_msg

String

Error message.

Minimum length: 2 characters

Maximum length: 512 characters

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 8 characters

Maximum length: 36 characters

error_msg

String

Error message.

Minimum length: 2 characters

Maximum length: 512 characters

Example Request

Exporting the Top SQL template list

GET https://das.cn-north-1.myhuaweicloud.com/v3/054c630ff780d4cc2f40c00d7f6fb21d/instances/6243b3fcf2f948578d46ed4c52fb54eein01/top-sql-templates?start_at=1611975464337&end_at=1611979064337&node_id=fec05693c76c4f389561051db430324cno01&sort=avgCost&asc=true&datastore_type=MySQL&offset=0&limit=10

Example Response

Status code: 200

Success

{
  "top_sql_templates" : [ {
    "db_name" : "db_01",
    "execute_num" : 30,
    "avg_rows_examined" : 0,
    "total_cost_ratio" : "100.00%",
    "avg_lock_time" : 0,
    "sql_template" : "SELECT sleep(?)",
    "avg_rows_affected" : 0,
    "avg_rows_sent" : 1,
    "avg_cost" : 5000.266666666666,
    "execute_num_ratio" : "23.81%",
    "total_examined_ratio" : "-",
    "sql_type" : "select",
    "total_cost" : 150008,
    "total_rows_examined" : 0,
    "sql_sample_string" : "select sleep(5)"
  } ],
  "total_count" : 1
}

Status Codes

Status Code

Description

200

Success

400

Client error

500

Server error

Error Codes

For details, see Error Codes.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback