Hi! I'm looking for some support to understand how...
# ask-questions
b
Hi! I'm looking for some support to understand how Growthbook uses BigQuery and how to keep costs down. We are preparing to run our first experiment with Growthbook connected to GA4 via BigQuery, but have run into extremely high BigQuery costs even before starting the experiment. The cost comes from the test queries of the experiment assignment query plus a couple fact tables and metrics we set up in the Growthbook dashboard. If these costs are representative of the BigQuery costs we would see during regular experimentation, it would mean we can't proceed with using Growthbook for experimentation. We are hoping we can either update our configuration to minimize costs, or that this was perhaps a one-time cost for initial setup and that the future costs will be lower. If anyone from Growthbook is available to help dive into these costs, I can provide more details in a DM.
h
Hey Brooks! 1. on test queries... at the very bottom of the Settings . General page, under Data Source Settings, we let you configure the number of days scanned in test queries. It defaults to 30, I believe, and you can shorten it if you'd like. 2. on general costs... our queries default to scanning only the needed days of data from your datawarehouse to ensure we're not scanning more data than we need to; this is especially important for BQ where on-demand pricing normally is based on the number of rows scanned. Making sure that the queries being executed are only scanning the right days of data and removing unnecessary joins or custom logic that might be causing a ton of additional data to be scanned are some of the steps you can take right away. Enterprise customers can also use the Fact Table optimization to reduce the cost of running multiple queries over the same fact tables: https://docs.growthbook.io/kb/metrics/fact-metric-optimization.
b
Hi. Luke! Thanks for the advice, especially the tip about the default days scanned for test queries, that should help a lot. While an experiment is running, will Growthbook ever run queries automatically? Or only when we click the "Update" button on the results page?
h
You can control this behavior. On that same settings page under Experiment Settings there is a schedule you can set. You can also disable it.
b
@helpful-application-7107 Nice, thanks again. When in the edit window for the experiment assignment SQL, is it running any queries in the background? I ask because we are seeing more activity from Growthbook in BigQuery than we expect around the time that we were editing that experiment assignment query, including some jobs that took over a minute (which we don't recall having to wait for). Also the editing window was very slow to respond to keyboard interactions. So we think it may have been doing something in the background.
h
Hmm, I'm not sure if we run some initial queries, but when editing the experiment assignment query, there's 3 queries that can run, I think. The Test Query manually run in the top right. The "test before saving" check box in the bottom governs whether we run a query on save. And then the schema browser on the right can also run queries, but after first being set up I think it only refreshes when you as it to.
There are a few points in the app where we run queries in the back ground, but we try to keep those to a minimum. If you want to share the query being run here or in DM maybe I'll have more of an answer for you.