tencent cloud

TencentDB for MongoDB

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Strengths
Use Cases
Cluster Architecture
Product Specifications
Features
Regions and AZs
Terms
Service Regions and Service Providers
Purchase Guide
Billing Overview
MongoDB Pricing
Billing Formula
Payment Overdue
Backup Space Billing
Configuration Adjustment Billing
Getting Started
Quickly Creating an Instance
Connecting to a TencentDB for MongoDB Instance
Reading/Writing Database
Operation Guide
Access Management
Instance Management
Node Management
Version Upgrade
Network Configuration
Monitoring
Backup and Rollback
Database Audit
Data Security
SSL Authentication
Log Management
Database Management
Multi-AZ Deployment
Disaster Recovery/Read-Only Instances
Parameter Configuration
Recycle Bin
Task Management
Performance Optimization
Data Migration Guide
Practical Tutorial
Optimizing Indexes to Break Through Read/Write Performance Bottlenecks
Troubleshooting Mongos Load Imbalance in Sharded Cluster
Considerations for Using Shard Clusters
Sample of Reading and Writing Data in MongoDB Instance
Methods for Importing and Exporting Data Based on CVM Connected with MongoDB
What to Do for Errors of Repeated Instance Creation and Deletion of Databases with the Same Names?
Troubleshooting MongoDB Connection Failures
Shard Removal Task: Guide for Confirming the Progress and Troubleshooting Issues
Performance Fine-Tuning
Ops and Development Guide
Development Specifications
Command Support in Sharded Cluster v3.2
Command Support in v3.6
Development Ops
Troubleshooting
Increased Slow Queries
Number of Connections Exceeding Limit
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Backup APIs
Account APIs
Other APIs
Task APIs
Introduction
Data Types
Error Codes
Instance Connection
Shell Connection Sample
PHP Connection Sample
Node.js Connection Sample
Java Connection Sample
Python Connection Sample
Python Read/Write Sample
Go Connection Sample
PHP Reconnection Sample
Product Performance
Test Environment
Test Method
Test Result
FAQs
Cost
Features
Sharded Cluster
Instance
Rollback and Backup
Connection
Data Migration
Others
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us

Slow Log Query

PDF
Focus Mode
Font Size
Last updated: 2025-08-22 16:37:44
The TencentDB for MongoDB (MongoDB) console supports viewing slow logs. Slow logs record database operations that exceed a specified execution time threshold. These logs are used for performance monitoring and optimization, helping developers and Ops personnel identify and address performance bottlenecks.

Background

In MongoDB, slow logs are often used as a basis for optimizing business operations. For more information about slow logs, see official documentation.
The system provides the following two query methods:
Abstract query: Query slow logs based on a specified time range. The results are presented as an aggregated analysis by command (operation) type.
Specific query: Query slow logs by specifying a specific operation command. The results are displayed in a list format, showing the execution duration of the command and the corresponding log details.

Version Description

All current versions of MongoDB support slow log management.

Use Instructions

The system records operations that take longer than 100 milliseconds to execute.
Slow logs are retained for 7 days, and each query can cover a time range of up to 1 day.
Queries are limited to the first 10,000 slow log entries. If the query is slow, narrow the time range.

Prerequisites

You have created a TencentDB for MongoDB instance.
The status of the replica set instance or sharded instance of TencentDB for MongoDB is Running.

Operation Steps

Querying Slow Logs

2. In the left sidebar, expand the MongoDB dropdown list and select either Replica Set Instance or Shard Instance. The operations for replica set instances and sharded instances are similar.
3. Select a region at the top of the instance list page on the right.
4. Locate the target instance in the instance list.
5. Click the Target Instance ID to go to the Instance Details page.
6. Select the Log Management tab. On the Slow Log Query page, select a Query Method to query slow logs.
Abstract query: Select the Query Time Period, set the Time Consumed threshold, and then click Query.
Specific query: Select the specific execution command in query command, and then select the Query Time Period and set the Time Consumed threshold. Click Query.
7. View and analyze slow logs.
Abstract query results include the following four fields:
Query method: Abstract query.
Sample Command: A statement output with the command type as the aggregation dimension, recording the operations in slow logs. The command field serves as the primary reference for troubleshooting.
Note:
Pay attention to keywords such as command, COLLSCAN, IXSCAN, keysExamined, and docsExamined. For more details on log entries, see MongoDB Official Website.
Command indicates the operation recorded in the slow log.
COLLSCAN indicates that the query performed a full table scan, while IXSCAN indicates that an index scan was performed.
keysExamined represents the number of index entries scanned, and docsExamined represents the number of documents scanned. The higher these values are, the more likely it is that there is no index in place or that the existing index has low selectivity. For guidance on index optimization, see Optimizing Indexes to Break Through Read/Write Performance Bottlenecks.
Average Execution Time (ms): The average execution time, in milliseconds, of operations aggregated by command type.
Total: The number of operations aggregated by command type.

Query details results include the following three fields:
Query Method: Specific query.
Time consumed: Execution time of the business command, measured in milliseconds.
Log details: Details of the business command.


Related APIs

API
API Description
DescribeSlowLogs
DescribeSlowLogPatterns

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback