Key Takeaways
- BigQuery charges $6.25 per TB scanned - optimize queries to reduce data processed
- Snowflake uses credit-based billing - warehouse size directly impacts cost per second
- Partitioning and clustering can reduce query costs by 50-90%
- Reserved capacity can save 30-60% for predictable workloads
- Small queries often have minimum billing (10 MB in BigQuery, 60 seconds in Snowflake)
Understanding SQL Query Costs in the Cloud
Cloud data warehouses have revolutionized how organizations store and analyze data, but understanding their pricing models is crucial for cost management. Unlike traditional databases with fixed infrastructure costs, cloud platforms charge based on usage - typically either data scanned or compute time.
The two primary billing models are:
- Data-based billing (BigQuery, Synapse): You pay per byte of data your query processes. Optimizing query structure and using partitions dramatically reduces costs.
- Time-based billing (Snowflake, Redshift): You pay for compute time multiplied by warehouse size. Query optimization and right-sizing warehouses are key.
Google BigQuery Pricing
BigQuery offers two pricing models:
- On-demand: $6.25 per TB scanned (first 1 TB free monthly)
- Flat-rate: $2,000/month for 100 slots (unlimited queries)
Query Cost = (Data Scanned in TB) x $6.25
BigQuery Cost Optimization
Use SELECT * sparingly - selecting only needed columns can reduce costs by 80%+. Preview queries with dry runs (--dry_run flag) to see data scanned before execution. Partition tables by date and cluster by frequently filtered columns.
Snowflake Pricing
Snowflake charges based on compute credits consumed:
- Standard Edition: ~$2.00 per credit
- Enterprise Edition: ~$3.00 per credit
- Business Critical: ~$4.00 per credit
Query Cost = (Runtime in hours) x (Credits/hour) x ($/credit)
Amazon Redshift Serverless Pricing
Redshift Serverless uses RPU (Redshift Processing Units):
- Base price: $0.36-0.50 per RPU-hour
- Minimum: 8 RPUs base capacity
- Billing: Per-second after first minute
Azure Synapse Analytics Pricing
Synapse serverless SQL pool charges per TB scanned:
- On-demand: $5.00 per TB processed
- First 1 TB: Free each month
Frequently Asked Questions
It depends on your workload. For sporadic, ad-hoc queries on large datasets, BigQuery's pay-per-TB model often wins. For consistent, heavy workloads, Snowflake or Redshift with reserved capacity can be more economical. Azure Synapse is competitive at $5/TB for Microsoft-heavy environments.
1) Select only needed columns instead of SELECT *. 2) Use partitioned tables and filter on partition columns. 3) Use clustering for frequently filtered columns. 4) Enable query caching. 5) Use LIMIT during development. 6) Consider flat-rate pricing for heavy workloads.
A Snowflake credit is a unit of compute resource consumption. An X-Small warehouse uses 1 credit per hour, Small uses 2, Medium uses 4, and so on (doubling each size). Credits cost $2-4 depending on your Snowflake edition and region.
In BigQuery, cached query results are free. In Snowflake, if the result is served from the result cache, no compute is used (free). However, if the query needs to re-execute due to underlying data changes or cache expiration, normal charges apply.
BigQuery has a 10 MB minimum per query. Snowflake has a 60-second minimum billing per query (warehouse must run for at least 1 minute). Redshift Serverless has per-second billing after the first minute. Consider batching small queries to avoid minimum charge waste.