In business scenarios, slow queries are performed on a Time Series Database (TSDB) instance. This causes heavy loads and compromises the performance of the TSDB instance. To troubleshoot issues that degrade the instance performance, you can use the Slow query log module in the TSDB console.
Log on to the TSDB console.
On the Instances page, find the instance that you want to manage and click Manage in the Actions column.
In the left-side navigation pane, choose Time Series Data Management > Slow query log.
In the upper-left corner of the Slow query log page, specify a time range to search for the desired slow query logs and click Search. Then, you can view all slow queries that are performed on the TSDB instance within the specified time range.
Queries that take longer than 1 second to run are slow queries. Queries that take less than 1 second to run are not recorded.
The following list describes the parameters of slow queries.
The time taken for a slow query to run on TSDB.
The time when a slow query is logged.
If a query is slow, TSDB logs the query. Query logging is not based on whether the query succeeds or fails. TSDB determines whether the query is slow based on the time taken to run the query.
The query conditions that are received by the TSDB instance. The query conditions are deserialized. The actual statement that you execute can contain extra internal fields.
The IP address of the client from which a query is sent. The IP address varies based on network types. For example, the IP address can be a private IP address if the TSDB instance is deployed in a virtual private cloud (VPC).
You can use the Slow query log module in the TSDB console only when the following conditions are met:
The version of the engine on which the TSDB instance runs is later than V2.6.7. For more information about how to view the engine version, see View the details of an instance.
The account that you use to log on to the TSDB console has the AliyunHiTSDBReadOnlyAccess permission.
After you identify slow queries based on the slow query logs, you can take measures to optimize the slow queries. For example, you can reduce the amount of time series data to query or reduce the number of data points to query. This can make queries efficient. For more information, see Reduce the amount of time series data to query and Reduce the number of data points to query.