BigQuery’s on-demand pricing can actually be cheaper than flat-rate pricing, even for frequent users, if you’re not careful about how you query.
Let’s see it in action. Imagine you have a table mydataset.mytable with 1TB of data.
Scenario 1: On-Demand Query
You run a simple SELECT COUNT(*) query.
SELECT COUNT(*) FROM mydataset.mytable;
This query scans the entire 1TB table. On-demand pricing is $5 per TB scanned. So, this query costs:
1 TB * $5/TB = $5
Now, imagine you run this query 10 times a day, 30 days a month.
10 queries/day * 30 days/month * $5/query = $1500/month
That’s starting to add up.
Scenario 2: Flat-Rate Pricing
BigQuery offers flat-rate pricing in slots. A slot is a unit of computational capacity. You can purchase commitments for dedicated slots for 1 minute, 1 month, or 1 year.
A common starting point is a 100-slot commitment. A 1-month commitment for 100 slots costs approximately $2,000/month (prices vary by region and commitment duration).
With 100 dedicated slots, you can run many queries concurrently. If your 1TB COUNT(*) query takes, say, 1 minute of slot time to complete, and you have 100 slots available, you could theoretically run 100 such queries concurrently in that minute.
Let’s say your daily workload of 10 COUNT(*) queries, each taking 1 minute of slot time, runs over a period of 1 hour. This means you’re using 10 slots for 1 hour (10 queries * 1 minute/query = 10 minutes of total slot-time, spread over the hour, assuming they don’t overlap perfectly).
If your total monthly slot usage, considering all your queries, stays well below the capacity of your 100 slots for the entire month, you might be paying $2,000 for potentially much less than $1,500 worth of scanned data.
The Mental Model: On-Demand vs. Slots
On-demand pricing is like paying for electricity by the kilowatt-hour. You pay for exactly what you consume (data scanned). This is great for infrequent, unpredictable workloads, or for ad-hoc analysis where you’re not sure how much data you’ll scan.
Flat-rate pricing, on the other hand, is like subscribing to a dedicated internet line. You pay a fixed monthly fee for a certain amount of bandwidth (slots), regardless of how much you use. This is ideal for predictable, high-volume workloads where you know you’ll be consuming a significant amount of computational resources.
The key levers you control are:
- Data Scanned (On-Demand): The primary cost driver. Optimize queries to scan less data (e.g., partition and cluster tables, select only necessary columns, use
WHEREclauses effectively). - Number of Slots (Flat-Rate): The capacity you purchase. Too few, and your queries queue up, leading to longer wait times. Too many, and you overpay.
- Slot Usage Duration (Flat-Rate): How long your queries actively use slots. This is what the flat-rate price is based on, not the data scanned.
Which Saves More?
The break-even point depends heavily on your query patterns and efficiency.
-
On-Demand Wins If:
- Your total monthly data scanned is less than 400 TB (400 TB * $5/TB = $2000).
- Your queries are highly optimized and scan significantly less data than their full table size.
- Your workload is highly variable and unpredictable, making a fixed slot commitment wasteful.
-
Flat-Rate Wins If:
- You consistently scan more than 400 TB of data per month.
- Your queries are inefficient and scan large amounts of data, but you can afford the slot commitment.
- You have predictable, high-volume workloads that would otherwise incur massive on-demand costs.
- You need consistent, low-latency query performance, which flat-rate guarantees by reserving slots.
The most surprising truth is that a single, poorly optimized query scanning terabytes of data on-demand can cost more than a month of dedicated 100 slots. This is because on-demand pricing is directly tied to the raw data scanned, while flat-rate is tied to the time your queries occupy computational resources. If your queries are fast but scan a lot, on-demand can be a surprise expense.
The next problem you’ll run into is understanding how to accurately estimate your slot usage for flat-rate pricing.