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
OneAccess
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 Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
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
Intelligent EdgeCloud
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

Viewing Slow Query Logs

Updated on 2025-02-12 GMT+08:00

Scenarios

Slow Query Logs displays a chart of SQL statements that are taking too long to execute and allows you to sort slow SQL statements by multiple dimensions, such as by user, host, or SQL template. It helps you quickly identify bottlenecks and improve instance performance.

Viewing Slow Query Logs

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner of the page and choose Databases > TaurusDB.
  4. On the Instances page, click the instance name.
  5. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  6. Click the Slow Query Logs tab.

    NOTE:
    • Slow Query Logs needs to be purchased separately. To use this function, subscribe to Intelligent O&M first.
    • Only the data of the last hour is displayed if Intelligent O&M is not subscribed. The data will be automatically deleted after one hour. After Intelligent O&M is subscribed, data can be stored for up to 30 days. For details, see Slow Query Log Storage.

  7. Click Subscribe. In the displayed dialog box, you can learn about Intelligent O&M functions and pricing.

    The Intelligent O&M fee for each instance consists of:
    • Basic price: $0.075 USD/hour
    • SQL storage: $0.0072 USD/GB/hour

    Get 5 GB of storage for free after your instance has subscribed to Intelligent O&M.

    Figure 1 Subscribing to Intelligent O&M

  8. Select "I have read and understand the billing rules." and click Subscribe.
  9. Select a time range and view trends, details, and statistics of the slow query logs generated within the time range.

    You can view slow query logs in the last 1 hour, 3 hours, 12 hours, or a custom time period (no longer than one day).

    • Slow Queries over Time

      Above the chart, you can switch to another instance or node to view its slow queries.

      You can move the cursor to a point in time of the chart to view the number of slow query logs and CPU usage at the point in time.

      Figure 2 Slow Queries over Time

    • Details

      View slow query log details in the lower part of the Slow Query Logs page. The details include the SQL statement, execution start time, database, client, user, execution duration, lock wait duration, and scanned and returned rows.

      Figure 3 Details

      Click Export to export slow query log details to a specific OBS bucket. After the log details are exported, you can click View Export List to view export records.

      Filter slow query log details by database, client IP address, or user.

      Locate an SQL statement and click Concurrency Control in the Operation column to create an SQL concurrency control rule. For details, see Configuring SQL Statement Concurrency Control.

      Click Export. In the displayed dialog box, select an OBS bucket and click OK to export slow query logs to the OBS bucket. Up to 100,000 logs can be exported.

      If no OBS bucket is available, click Create. In the displayed dialog box, enter an OBS bucket name, and click OK.

      Creating an OBS bucket is free, but you will be billed for storing data in the bucket. For pricing details, see OBS Pricing Details.

      A bucket name:
      • Cannot be the same as that of any existing bucket.
      • Can contain 3 to 63 characters. Only lowercase letters, numbers, hyphens (-), and periods (.) are allowed.
      • Cannot start or end with a period (.) or hyphen (-), and cannot contain two consecutive periods (.) or contain a period (.) and a hyphen (-) adjacent to each other.
      • Cannot be an IP address.
      • If the bucket name contains a period (.), certificate-based verification is required when you use the name to access an OBS bucket or object.

      After the log details are exported, you can click View Export List to view export records. You can also download the details to your local PC for analysis.

    • Statistics
      Figure 4 Statistics

      Click View Sample in the Operation to view the sample of the SQL template.

      Click Export. In the displayed dialog box, select an OBS bucket and click OK to export slow query logs to the OBS bucket. Up to 100,000 logs can be exported.

      If no OBS bucket is available, click Create. In the displayed dialog box, enter an OBS bucket name, and click OK.

      Creating an OBS bucket is free, but you will be billed for storing data in the bucket. For pricing details, see OBS Pricing Details.

      A bucket name:
      • Cannot be the same as that of any existing bucket.
      • Can contain 3 to 63 characters. Only lowercase letters, numbers, hyphens (-), and periods (.) are allowed.
      • Cannot start or end with a period (.) or hyphen (-), and cannot contain two consecutive periods (.) or contain a period (.) and a hyphen (-) adjacent to each other.
      • Cannot be an IP address.
      • If the bucket name contains a period (.), certificate-based verification is required when you use the name to access an OBS bucket or object.
      • After the templates are exported, you can click Export Slow Query Logs to view export records. You can also download the details to your local PC for analysis.
    • Top 5 Slow Query Logs

      View the top 5 slow query logs by user or client IP address.

      Figure 5 Top 5 Slow Query Logs

Slow Query Log Storage

After Collect Slow Query Logs is enabled, SQL text content will be stored in OBS for analysis.

  • If you have subscribe intelligent O&M, click Log Settings in the upper right corner.
    • Slow Query Log Period: The default value is 7. The value ranges from 1 to 30. After the period expires, the logs are automatically deleted.
    • SQL Insights Retention Period: The default value is 7. The value ranges from 1 to 180.
    • Log Size: Each paid instance can use 5 GB of storage for slow query logs for free. Any storage used in excess of 5 GB will be billed on a pay-per-use basis.
    Figure 6 Log storage and archiving (Intelligent O&M subscribed)

  • If you do not subscribe intelligent O&M, click Log Settings in the upper right corner.
    • Slow Query Log Period: The default value is 1 hour and cannot be changed. After the period expires, the logs are automatically deleted.
    • SQL Insights Retention Period: 1 hour
    Figure 7 Log storage and archiving (Intelligent O&M not subscribed)

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback