Cloud data warehouses like Snowflake, BigQuery, and Redshift charge based on compute and storage.
Query cost optimization reduces these costs through better query design, clustering,
partitioning, query pruning, caching, and materialized views. This guide covers the cost models
of major cloud warehouses, optimization techniques, and the 25 interview questions that actually
come up — with deep, descriptive theory aligned to the topic.
🎯 Key Takeaways
Cost optimization reduces compute and storage costs
Query pruning skips irrelevant data
Clustering organizes data within tables
Partitioning divides tables into segments
Caching speeds up repeated queries
Materialized views pre-compute results
25 Interview QuestionsBeginner to AdvancedSnowflake, BigQuery, RedshiftUpdated Dec 3, 2026
KW
Kailas Warade
✓ Verified Author
Data Engineer · Oracle Certified · SQL & PL/SQL
Kailas works with SQL, PL/SQL, Python, and PySpark to build data pipelines.
He writes the SQL interview guides at Sankalan Data Tech, focused on
practical, real-world answers.
🏆 Oracle Certified💼 Data Engineer📝 SQL & PL/SQL Guides📍 Pune, India
Cloud data warehouse cost optimization is the practice of reducing query and storage costs
in cloud data warehouses like Snowflake, BigQuery, and Redshift.
The core insight is that cloud warehouses charge based on usage — compute time, bytes
scanned, or slots used. Reducing usage reduces cost.
Cost optimization is not just about writing faster queries. It is about writing queries
that scan less data, use less compute, and leverage caching.
Cost optimization is a critical skill for data engineers working with cloud warehouses,
where costs can escalate quickly.
Cloud Warehouse Pricing Models
Each cloud warehouse has a different pricing model.
Warehouse
Compute Pricing
Storage Pricing
Snowflake
Warehouse compute time
Storage used
BigQuery
Bytes scanned or slots
Storage used
Redshift
Node hours
Storage used
Snowflake charges based on warehouse compute time — larger warehouses cost more per second.
BigQuery charges based on bytes scanned or slots used — reducing bytes scanned reduces
cost.
Redshift charges based on node hours — smaller clusters cost less.
Understanding the pricing model is the first step to cost optimization.
Query Pruning in Depth
Query pruning is the ability of a warehouse to skip reading irrelevant data based on
filters.
-- Query with filter enables pruning
SELECT *
FROM sales
WHERE order_date = '2026-12-01';
-- Only scans relevant partition/cluster
Query pruning is the single biggest cost optimization lever. If a query only needs 1% of
the data, pruning ensures only 1% is scanned.
Pruning works through partitioning, clustering, and zone maps.
Always include filters on partition/cluster columns to enable pruning.
Clustering in Depth
Clustering in Snowflake organizes data within a table based on one or more columns.
-- Clustering in Snowflake
CREATE TABLE sales (
order_date DATE,
amount DECIMAL
) CLUSTER BY (order_date);
Clustering improves query pruning by co-locating related data. Queries filtering on the
cluster key scan less data.
Clustering is automatic in Snowflake — it re-clusters as needed.
Choose cluster keys based on common query filters.
Partitioning in Depth
Partitioning in BigQuery divides a table into segments based on a column (like date).
-- Partitioning in BigQuery
CREATE TABLE sales (
order_date DATE,
amount DECIMAL
)
PARTITION BY DATE(order_date);
Partitioning enables query pruning by allowing queries to scan only relevant partitions.
Partitioning is explicit in BigQuery — you must define it at table creation.
Choose partition keys based on common query filters, usually date.
Caching in Depth
Caching stores query results or data in memory to speed up repeated queries.
-- Cached query: same query, faster and cheaper
SELECT * FROM sales WHERE order_date = '2026-12-01';
-- Second run: cached, faster and cheaper
Caching is automatic in most cloud warehouses. Repeated queries hit the cache and cost
less.
Cache is invalidated when underlying data changes.
Caching is a free cost optimization — just structure queries to leverage it.
Materialized Views
A materialized view is a pre-computed result set stored physically.
-- Materialized view
CREATE MATERIALIZED VIEW mv_daily_sales AS
SELECT order_date, SUM(amount) AS total
FROM sales
GROUP BY order_date;
Materialized views improve query performance and reduce cost for repeated queries.
Materialized views must be refreshed when underlying data changes.
Materialized views are ideal for expensive, frequently-run aggregations.
25 Cloud Warehouse Cost Optimization Interview Questions and Answers
These are the cloud warehouse cost optimization questions that come up most often in data
engineering interviews. Every answer stands on its own — read them in any order, or work
through them in sequence to build a complete understanding of cost optimization, query
pruning, clustering, partitioning, caching, and materialized views.
/
🔍
No matching questions found
Try a keyword like Snowflake, BigQuery, clustering, or pruning.
Cloud warehouse cost optimization is the practice of reducing query and storage
costs in cloud data warehouses.
Well-designed cost optimization follows a few key principles.
Use partitioning/clustering — for query pruning.
Avoid SELECT * — scan only needed columns.
Use filters — enable pruning.
Use caching — for repeated queries.
Use materialized views — for expensive aggregations.
Monitor cost — identify and fix expensive queries.
-- Well-designed query
SELECT order_date, SUM(amount)
FROM sales
WHERE order_date = '2026-12-01'
GROUP BY order_date;
These principles produce queries that are fast and cheap.
Mistakes I Keep Seeing in Interviews
These come up repeatedly. None of them are exotic, and every one of them is easy to avoid
once you know it is coming.
Mistake one: not understanding the pricing model. Each warehouse charges
differently, and optimization strategy depends on it.
Mistake two: confusing clustering with partitioning. They are related but
different — know the difference.
Mistake three: using SELECT *. This scans all columns, increasing cost.
Mistake four: not using filters. Filters enable pruning, which reduces
cost.
Mistake five: not using caching. Repeated queries should hit the cache.
Mistake six: not monitoring cost. Without monitoring, expensive queries go
unnoticed.
Follow-Up Questions Interviewers Ask
Getting the first answer right is only half the interview. What usually decides the
outcome is what happens next. Here is what to prepare for on the cost optimization topic.
After “What is cost optimization?” — expect
“What is the pricing model of Snowflake/BigQuery/Redshift?”
“What is query pruning?”
“What is clustering?”
“What is partitioning?”
After “Query pruning” — expect
“How does pruning work?”
“What enables pruning?”
“How do you measure pruning?”
“What is a zone map?”
After “Clustering” — expect
“How does clustering work?”
“How do you choose cluster keys?”
“What is automatic clustering?”
How does clustering affect cost?”
After “Materialized views” — expect
“What is the difference from a view?”
“How do you refresh?”
“When would you use one?”
“What are the trade-offs?”
For every question above, prepare a second-level answer. The candidates who pass are not
the ones who memorized the first answer — they are the ones who kept going for another
thirty seconds and said something useful about why it matters.
Quick Quiz
Five questions to check whether the topics above have landed.
1. What is the biggest cost optimization lever in cloud warehouses?
2. What does Snowflake charge based on?
3. What does BigQuery charge based on?
4. What is the difference between a view and a materialized view?