All Products
Search
Document Center

Reduce hit timelines to improve query efficiency

Last Updated: May 14, 2020

This topic describes how to optimize query policies to increase query efficiency.

The query efficiency increases as the number of matched timelines decreases.

  • You can use the following methods to reduce the number of matched timelines.
    • Use the api/search/lookup API endpoint to view the number of matched timelines. The following example is used to explain how to use the api/search/lookup API endpoint: curl http://localhost:3002/api/search/lookup?m=sys.cpu.usage.
    • Specify a suitable data collection interval to control the number of matched timelines. For example, if the data collection interval is 10 seconds, the number of data points for a timeline is 8,640 per day.
    • Select tag key-value pairs that have high cardinality as the filter conditions in queries. An example is used to explain this method. In this example, 4 data centers have 1,000 IP addresses. If the filter condition is IP address=172.220.110.1 instead of data center=A, less matched timelines are returned.
    • Avoid fuzzy query criteria. For example, you can avoid wildcard queries. If the fuzzy query criteria are required, we recommend that you add a condition that uses the literal_or filter and the equal to operator.
    • Pre-aggregate data and write the aggregated data before you query low-cardinality column values. An example is used to explain this method. In this example, Data center A has 1,000 IP addresses. Before you query the maximum CPU usage of Data center A, you can pre-aggregate the CPU usage data of Data center A and write the aggregated data.