All Products
Search
Document Center

Time Series Database:Slow query logs

Last Updated:Mar 23, 2022

In some business scenarios, slow queries can occur if you run queries during traffic spikes. This can cause heavy loads on your Time Series Database (TSDB) instance and degrade the overall instance performance. To locate the issues that degrade the instance performance, you can use the Slow query log module in the TSDB console.

Procedure

  1. Log on to the TSDB console.

  2. On the Instances page, find the instance that you want to manage and click Manage in the Actions column.

  3. In the left-side navigation pane, choose Time Series Data Management > Slow Query Log.

  4. 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 run on the TSDB instance within the specified time range.

Note

In the TSDB console, queries that take longer than 1s to run are viewed as slow queries. Queries that take less than 1s to run are not recorded.

The following list describes the parameters of slow queries.

  • Execution time

    The time that is required for a slow query to run on TSDB.

  • Log time

    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 that is required for the query to run.

  • Statement

    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.

  • Source IP

    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).

Notice

You can use the Slow query log module in the TSDB console only when the following conditions are met:

  • The engine version of the TSDB instance 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.