All Products
Search
Document Center

Optimize slow queries

Last Updated: Sep 09, 2021

Optimize slow queries

During daily business development, slow queries are common in OpenSearch because of many factors such as inappropriate operations, a large number of filter conditions, and sharply increased queries per second (QPS) during a period of time. The slow query analysis feature provided by OpenSearch allows you to view the details of slow queries that consume heavy logical computing unit (LCU) resources within a specified period of time. The feature also provides corresponding optimization suggestions to help you reduce costs.

Benefits

  • Free to use: You can enable and use the slow query analysis feature for free.

  • Use on demand: You can query the records of slow queries in the last month and obtain corresponding optimization suggestions.

  • Comprehensive metrics: You can analyze the causes of slow queries based on metrics such as average LCU consumption, peak-hour LCU consumption, total LCU consumption, and percentage of slow queries in total queries. You can also sort slow queries based on the preceding metrics in ascending or descending order.

Usage notes

  • The slow query analysis feature allows you to analyze the data that is generated on the previous day. Analyzed sample results are retained for up to 30 days.

Procedure

1.Enable the slow query optimization feature if you use it for the first time: Log on to the OpenSearch console. In the left-side navigation pane, choose Feature Extensions > Slow Search Optimization.

Enable

On the Slow Search Optimization page, select an application for which you want to enable the slow query optimization feature, select Open slow query analysis service and Read Usage Commitment, and then click Confirm activation.2

2.Analyze query data: After the slow query optimization feature is enabled, click Analyze.3Wait until the analysis is complete.4

3.View the results after the slow query data is analyzed: You can select different time ranges to query the slow query results on a specific day.5You can also sort the analysis results by different dimensions. 6The following figure shows the analysis reports.7