Use this guide to optimize your queries, making them faster and more reliable. Well-optimized queries are also easier for you to handle if you need to make changes.
Create lighter queries
Use the "Combine new results with old" setting
The amount of data determines how long a query will take to run, so only select the fields that are vital in each query. The “Combine new results with old” setting can help to reduce the amount of data each query requests.
Example
For example, if you’re querying the last two weeks of data using the date and campaign name, the query will have to calculate the selected metrics for each date per campaign. So even if you have only 4 campaigns, that will multiply the 14 days you're querying for 56 rows of data. This means your query will run 56 calculations — one for each row — for every metric you include.
Use advanced settings
Advanced settings can help reduce the size of a query, too. Here's one that's especially useful for query optimization:
- “KEEP_RESULTS_ON_REFRESH_ERROR”: The data won’t be replaced with the error message. Even the most simple queries can have errors and the error message will replace the data. (When using this setting, the error message can be found on the “SupermetricsQueries” tab. This is hidden by default — navigate to Extensions → Supermetrics → Manage queries to open it.)
Analyze your filters
Queries that use Supermetrics filters are heavier than ones that don’t. However, the filtering tools included in Google Sheets itself can be really helpful in trimming down your data.
They allow you to manipulate the data faster and save filtered views for the future. Learn more in Google’s documentation.