All Products
Search
Document Center

OpenSearch:Slow query optimization

Last Updated:Feb 08, 2023

Slow query optimization

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 specific period of time. The feature also provides 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 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 when you use the feature for the first time: Log on to the OpenSearch console. In the left-side navigation pane, choose Feature Extensions > Slow Search Optimization.

image

On the Slow Search Optimization page, select an application for which you want to enable the slow query optimization feature, select Enable Slow Query Analysis and Read Commitment for Use, and then click Enable.image

2. Analyze query data: After the slow query optimization feature is enabled, click Analyze.imageWait until the analysis is complete.image

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.imageYou can also sort the analysis results by different dimensions. imageThe following figure shows the analysis reports.

image