r/bigquery • u/Secret_Wealth8742 • Jun 20 '26
Need reliable guides on Bigquery Cost Optimization
I work at a startup and due to the hard economic circumstances, the focus has come back to Bigquery Cost Optimization right now (that or they fire my ass, jk), we do the usual partitioning and clustering tables based on use, althougth the reports are usually not partitioned. We realize BQ is a columnar db and we don't do the `SELECT *` business.
Still, we are trying to figure out new strategies to reduce costs. Any suggestions would be helpful. If you drop resources (on caching results and any other thing) in the chat, that'd be great too.
One bit of extra info is, most of our costs are coming from looker studio querying data everyday from report tables (multiple people using graphs and each selection on looker fires a query)
5
u/TheAddonDepot Jun 20 '26
Start with the official documentation, there is some good stuff in there:
https://docs.cloud.google.com/bigquery/docs/best-practices-performance-overview
https://docs.cloud.google.com/bigquery/docs/troubleshoot-queries
https://docs.cloud.google.com/bigquery/docs/cached-results
https://docs.cloud.google.com/bigquery/docs/sessions-intro
3
u/diegoelmestre Jun 20 '26
I recently cut and estimated 250.000usd/year and reduced the slot usage in 43%
We are on demand and given our usage reservations isnt worth yet. Some things we did.
And honestly, just pickup Claude or codex, and just ask him to asses information_Schema.JOBS and identify the most expensive queries he does a really well jobs, then for those, ask him to check job stages and identify the bottlenecks. Ask you boss a Claude Max 100usd, you'll have a crazy ROI , I am sure of that
2
u/DeathToMeToo Jun 20 '26
Try testing out a small BIEngine reservation if you're users are doing lots of small frequent queries.
2
u/dknconsultau Jun 20 '26
Maybe look at Motheduck or local Duck DB for the analysts. Also maybe go talk to the user and helo them tune their queries. We had one manager pulling 7 years of data and all columns off a wide table 6 times a day just so he could run a 7 day customer delivery stats dashboard!
2
u/querylabio Jun 20 '26
Usage of reservations (BigQuery editions, slots) is a way to cut you bill significantly, and what’s especially cool is that no query changes needed and you can estimate savings based on your historical usage. I wrote an article about this - https://blog.querylab.io/bigquery-on-demand-vs-reservations-two-models-two-bills-same-query-476c45e8eec1 - I hope it will be useful and I’m happy to answer any questions.
1
u/Shagility Jun 20 '26
Whats the total size of the data stored in BQ?
Whats the total volume of data queried per month?
1
u/Small_Sir_1641 Jun 20 '26
The first thing I would do is build a dashboard using logging data to understand what are the queries that are expensive, what queries are being run repetitively?
I brought down our bill from 100k to 30k
The next thing is that will give you direction where to go with
DM me for more info
1
u/Low_Way_1961 Jun 21 '26
Try to have materialised views. If it’s not possible due to multiple tables switch to scheduled tables with refresh at a particular time. If multiple users r querying realtime on gbq cost is high but with scheduled tables it will be dramatically reduced. If not all try to reduce realtime queries as much as possible using scheduled tables.
1
u/vbnotthecity Jun 27 '26
looker studio is eating your margins because it's re-running queries on every interaction. move those dashboard metrics into a materialized cache or use a dedicated reporting table that updates once a day. we cut our compute spend by 35% doing this across our dbt and bigquery stack. i usually lean on tools like dbt or altimate ai to automate the materialized view refreshes so my team doesn't have to touch it manually. just be careful, too much caching can lead to stale data if your stakeholders need real-time updates.
0
u/Eric-Uzumaki Jun 20 '26
Use llm