Thank you for using our product. Ensuring a high-performance experience is our responsibility.
So, as a user, why do you also need to understand how to optimize query performance?
The product relies on ClickHouse as the query engine to provide data retrieval and analysis capabilities. From a technical perspective, ClickHouse is likely the fastest OLAP engine in large-scale use today, and it is difficult to replace it with more advanced technology in the short term. Therefore, when using the same ClickHouse cluster, the machine configuration directly affects query speed.
For many data products, the platform is responsible for data production, and users simply act as consumers.
This product, as a self-service insight and analysis tool, not only provides dashboards, visualization, and other query tools, but also offers dataset functionality, allowing users to flexibly choose imported data and storage structures. These two aspects greatly affect query performance, yet are often overlooked. For many queries, performance is often determined when the dataset is created. To achieve fast dashboard queries, the dataset must be well designed.
Returning to the query itself, factors such as the amount of data queried, the operators used, whether the cache is hit, and whether the dataset settings are matched all affect query speed. Using appropriate query methods often enables faster query results.
The company can optimize from three dimensions: machine resources, data production, and query methods. This article focuses on methods for improving query performance by optimizing query methods.
If query performance is still unsatisfactory, feel free to contact us for more targeted solutions.
Improvements in query methods mainly rely on dashboard and chart owners or users who perform visual ad hoc queries.
Optimization methods | Criteria and rationale | Specific steps |
|---|---|---|
Try to ensure that queries hit the cache | Whether for real-time or offline data, as long as queries do not always require the latest data, there is an opportunity to hit the cache.
| Before July 1, check whether random sampling is enabled for the chart. Random sampling does not attempt to use the cache and has poor performance. If sampling is required, you can choose the default sampling method.
|
Reduce the number of days in query partitions. | Query as few days as possible, and reduce the amount of data queried by minimizing the number of partition days. | In visual queries, reduce the number of days in the p_date filter condition, and reduce the number of days in dashboard filters. |
Minimize or replace time-consuming operators. | Time-consuming operators such as countd, uniqExact, quantileExact, arrayhas, like, match, jsonExtract, and long case when statements can all lead to slow queries, and the query efficiency of some operators cannot be improved by upgrading cluster configurations. |
|
Use time-consuming analysis features less frequently | Some analysis features provided by DataWind may have high latency in large data volume scenarios, such as LOD, period-over-period analysis, comparison, detail totals, pivot table subtotals, and totals. |
|
Set sampling | For scenarios such as analyzing proportions, trends, avg, and quantiles, consider using the sampling feature. | Set the sampling ratio on the visualization page (prefer stable sampling before 6/25). Sampling reduces the amount of data read and affects sum and count results, but does not impact pie chart proportions, line chart trend analysis, or operators such as avg and quantile. |
Reduce dimensions | Most queries involve no more than five dimensions. Having too many dimension items will result in reading too many columns and increase computation costs. | Remove unnecessary dimensions |