How to optimize Supermetrics queries in Google Sheets

Prev Next

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 options and advanced settings

Advanced settings under Options in the Google Sheets sidebar can help reduce the size of a query, too. Some of the advanced settings you need to insert in the Advanced settings field and some are available as checkboxes.

Here's one that's especially useful for query optimization:

  • Keep previous results on refresh error checkbox: 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 ExtensionsSupermetricsManage 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.

Ensure no overlapping queries

Queries that overlap in Range address will overwrite new data when queries are refreshed. To avoid this, review the Range address column on the SupermetricsQueries tab in your Google sheet and ensure none overlap.

Limit your number of queries

We recommend a maximum of 50 queries per Google sheet. You could create more than this, however your queries may run more slowly as a result.

If you have a Google sheet that already has more than 50 queries, we suggest splitting these queries into other Google worksheets to reduce the total number of queries per worksheet.