Query Performance
Here are some guidelines for structuring your queries to improve performance.
-
Speed Up Queries with Dataflow Transformations
To speed up your queries and reduce the number of network round trips, perform data transformations in the ELT process instead of in the query.
-
Multivalue fields can cause poor performance. The behavior of these fields is undefined for
group-byandforeachstatements. If possible, write your query so that the fields are referenced only in filters. -
Use Group and Filter Pre-projection
Improve query performance by moving group and filter operations on simple fields before the
foreachstatement. A simple field is projected as-is and doesn’t have additional expressions. -
To improve memory usage and performance costs, remove unnecessary projections from your queries and load only the data required. If you have to perform an operation, include pre-projection statements as needed.
-
Binding and faceting in your dashboard design can generate redundant filters. Check the SAQL queries that your dashboard produces to remove unnecessary filters. Consider how a filter in your dashboard UI interacts with one in your query and vice versa.
-
unique()can affect query performance for large datasets that have over 100 million rows and include more than one million unique values. For large datasets,unique()is faster for measures than for dimensions. If counting the number of unique string values causes performance issues, convert the string to a number. For example, use a hash of the string value or refer to the index of the string in a sorted list of string values. -
arimax Show Parameters Query Tool
The
showParamsparameter is provided for you as a query developer tool. It allows you to run anarimaxquery and review the model parameters and Bayesian Information Criteria (BIC) to understand the data better and improve query efficiency.