Performance of Single-Table Point Query Is Poor
Symptom
The customer expects the result of single-table query to be returned within 1 second. However, the execution takes more than 10 seconds.
Possible Causes
This problem occurs because incorrect row- and column-store tables are selected. In this scenario, the row-store table and B-tree index should be used.
Cause Analysis
- The execution information about the faulty SQL statements shows that most of the time is spent on CStore Scan.
- The base table contains more than one billion data records. Incremental data is imported to the database in batches every night, and a small amount of data is cleaned. In the daytime, a large number of concurrent query operations are performed. The query does not involve table association, and the values of returned results are not large.
Handling Procedure
- Adjust the table definition, change the table to a row-store table, and create a B-tree index. The principles for creating a B-tree index are as follows.
- Analyze the customer's SQL statements before creating a B-tree index.
- Do not create redundant indexes.
- Place the columns with better filtering performance in the front of the index.
- Include as many filter criteria as possible in the index.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.