Snowflake Architecture and Core Concepts
Answer First: Reason about Snowflake from the request path: cloud services plan it, a virtual warehouse executes it, and micro-partition metadata limits the storage scanned.
Memory Map: services -> warehouse -> pruning -> cache -> history -> semi-structured data.
Day 1: Snowflake Architecture & Core Concepts
β
Pro Tip
Time: 5-6 hours | Priority: HIGHEST β Architecture is 35-40% of any Snowflake interview
Context: Travel booking platform with billions of daily transactions, multi-airline data, GDPR
Approach: Every topic β Simple explanation β Real-world analogy β Technical depth β Code β Interview tip
SECTION 1: SNOWFLAKE ARCHITECTURE (1.5 hours)
Answer First: Snowflake is a managed cloud data platform whose services layer plans queries, virtual warehouses execute them, and centralized columnar storage persists micro-partitions; storage and compute scale independently.
Memory Map: What is Snowflake? Explain its architecture. -> cloud services compile and authorize -> warehouses execute operators independently -> object storage retains shared micro-partitions [SF_01_Architecture_Core.md:15].
Q1: What is Snowflake? Explain its architecture.
Simple Explanation:
Snowflake is a cloud data warehouse β a platform where you store and query massive amounts of data using SQL. Unlike traditional databases (Oracle, SQL Server), Snowflake was built from scratch for the cloud. Its biggest innovation: separate storage from compute β the disk where data lives and the computers that process it are completely independent.
Real-world analogy: Think of a library (storage) and reading desks (compute). In a traditional database, reading desks are built INTO the library β only 10 desks, and they're always there (wasting space when empty). Snowflake is like: the library is in one building, and you can bring in 1 desk or 1000 desks as needed. When no one's reading, send all desks home (auto-suspend). The books (data) are always there regardless.
Why do we need it?
- Traditional databases: scale storage = must scale compute too (expensive, wasteful)
- Snowflake: scale each independently β run 10 warehouses on the same data simultaneously
The 3-Layer Architecture:
π Architecture Diagram
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LAYER 3: CLOUD SERVICES β
β The "brain" β always running, managed by Snowflake β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββ β
β β Query β β Metadata β β Auth & β β Optimizer β β
β β Compiler β β Manager β β Security β β & Planner β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββββββ β
β β’ Parses SQL β builds execution plan β
β β’ Manages metadata (table schemas, clustering info) β
β β’ Handles login, RBAC, encryption β
β β’ Optimizes queries (pruning, caching decisions) β
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β LAYER 2: COMPUTE (Virtual Warehouses) β
β The "muscles" β you turn them on when needed β
β β
β Warehouse A (XS) Warehouse B (L) Warehouse C (XL) β
β [ETL pipelines] [BI dashboards] [ML training] β
β β β β β
β Reads from storage Reads from storage Reads from storage β
β β
β β’ Independent from each other β no resource contention β
β β’ Auto-suspend (stop billing when idle) β
β β’ Auto-resume (start automatically when query arrives) β
βββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β LAYER 1: STORAGE β
β The "filing cabinet" β always on, centralized β
β β
β Data stored in Snowflake's proprietary compressed format β
β (micro-partitions β columnar, compressed Parquet-like files) β
β On AWS S3 / Azure ADLS Gen2 / Google Cloud Storage β
β β
β β’ Charged separately from compute (per TB/month) β
β β’ Stores table data + metadata + Time Travel versions β
β β’ Encrypted at rest (AES-256) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Key properties:
- Storage: Compressed columnar files in cloud object storage (S3/ADLS/GCS)
- Compute: Virtual warehouses β separate clusters, independent scaling
- Cloud Services: Query compilation, metadata, security β managed by Snowflake; cloud-services billing is not a flat percentage of cost
Interview tip: "Snowflake's key differentiator is true separation of storage and compute. Multiple virtual warehouses can query the same data simultaneously without competing for resources. That's impossible in traditional MPP databases like Redshift or Synapse."
Answer First: All data in Snowflake is automatically split into small pieces called micro-partitions. You don't define them β Snowflake creates them automatically as data is loaded. Each micro-partition is like a small drawer in a filing cabinet, containing 50-500 MB of compressed data (stored in columnar format).
Memory Map: What are Micro-Partitions? How are they different from Hive partitions? -> hidden columnar chunks -> min max zone maps -> pruning decision -> bytes skipped metric -> recluster signal [SF_01_Architecture_Core.md:79].
Q2: What are Micro-Partitions? How are they different from Hive partitions?
Simple Explanation:
All data in Snowflake is automatically split into small pieces called micro-partitions. You don't define them β Snowflake creates them automatically as data is loaded. Each micro-partition is like a small drawer in a filing cabinet, containing 50-500 MB of compressed data (stored in columnar format).
Real-world analogy: Imagine a huge bookshelf of flight booking records. Instead of one massive file, Snowflake automatically splits records into drawers of roughly equal size. On the label of each drawer: "min date = Jan 1, max date = Jan 15, airlines: AI, LH, EK". When you ask for March bookings, Snowflake reads only the labels and skips drawers that can't possibly contain March data.
Why do we need them?
Without micro-partitions: read the ENTIRE dataset even for one day's data.
With micro-partitions: Snowflake reads labels (metadata) first, skips irrelevant micro-partitions β only reads 1% of data for a filtered query.
Technical details:
Micro-partition 1: 50-500 MB compressed
β Min booking_date: 2026-01-01
β Max booking_date: 2026-01-15
β Airlines: ['AI', 'LH', 'EK']
β Rows: ~500,000
β Stored in: columnar format (all booking_dates together, all amounts together)
Micro-partition 2: 50-500 MB compressed
β Min booking_date: 2026-01-16
β Max booking_date: 2026-01-31
β Airlines: ['QR', 'EK', 'UA']
β Rows: ~480,000
Micro-partition N: ...
SELECT * FROM bookings
WHERE booking_date BETWEEN '2026-03-01' AND '2026-03-31'
AND airline_code = 'LH';
Micro-partitions vs Hive/Databricks partitions:
| Feature | Snowflake Micro-partitions | Hive/Databricks Partitions |
|---|
| Created by | Snowflake automatically | You must define manually |
| Granularity | 50-500 MB each (fine-grained) | Entire folder per partition value |
| Too many? | Never β Snowflake manages automatically | Yes β too many partitions = metadata overload |
| Metadata | Min/max per column per micro-partition | Just folder structure |
| Overlap | Can overlap (managed by clustering) | No overlap by design |
| Maintenance | Automatic (reclustering if needed) | Manual (must re-partition) |
β οΈ Key Interview Point: In Snowflake, you do NOT manually partition tables like in Hive. Micro-partitions are automatic. You may define clustering keys to optimize micro-partition layout β but this is separate from partitioning.
Interview tip: "Unlike Hive where you define partition columns and manage folder structure yourself, Snowflake automatically creates micro-partitions for every table. When data layout degrades over time (high overlap), I define a clustering key which triggers automatic reclustering β no manual maintenance needed."
Answer First: When data is inserted into Snowflake over time, micro-partitions can become mixed up β a partition might contain data from January, March, and July all mixed together. When you query for March data, Snowflake has to read ALL partitions. This is called high overlap or poor clustering.
Memory Map: What are Clustering Keys? When should you use them? -> access pattern columns -> overlap depth -> automatic clustering service -> maintenance credits -> profile proof [SF_01_Architecture_Core.md:142].
Q3: What are Clustering Keys? When should you use them?
Simple Explanation:
When data is inserted into Snowflake over time, micro-partitions can become mixed up β a partition might contain data from January, March, and July all mixed together. When you query for March data, Snowflake has to read ALL partitions. This is called high overlap or poor clustering.
A clustering key tells Snowflake: "When organizing micro-partitions, try to group rows with similar values for this column together." Snowflake then automatically re-clusters the table in the background.
Real-world analogy: Your filing cabinet started organized by date (Jan β Feb β March). Then you added 1 million new records randomly, and now each drawer has records from all months mixed in. Clustering key = hiring an assistant to re-sort and re-organize the drawers back to chronological order.
CREATE TABLE bookings (
booking_id VARCHAR,
booking_date DATE,
airline_code VARCHAR,
passenger_id VARCHAR,
amount NUMBER
)
CLUSTER BY (booking_date, airline_code);
SELECT SYSTEM$CLUSTERING_INFORMATION('bookings', '(booking_date, airline_code)');
ALTER TABLE bookings RECLUSTER;
When to use clustering keys:
β Table is very large (>1 TB or >100 million rows)
β You always filter by the same column(s)
β Your queries are slow despite having a virtual warehouse
β SYSTEM$CLUSTERING_INFORMATION shows high overlap/depth
β Table is small (<1 TB) β overhead not worth it
β You filter by many different columns each query β no single good key
β Data is already naturally clustered by insert order (time-series data)
β Table is write-heavy β reclustering runs constantly, costs credits
Interview tip: "For our travel-platform's booking table with 10 billion rows, I'd cluster by (booking_date, airline_code) since 90% of queries filter by date range and specific airline. But first I'd check SYSTEM$CLUSTERING_INFORMATION to confirm the current overlap is actually high β clustering costs credits, so don't add it unless needed."
Answer First: A Virtual Warehouse is the compute in Snowflake β a cluster of cloud VMs (servers) that execute your queries. You size it (XS, S, M, L, XL, 2XL, 3XL, 4XL), it auto-starts when a query arrives, runs the query, and auto-suspends when idle. You pay only when it's running.
Memory Map: What is a Virtual Warehouse? Explain sizing and multi-cluster. -> compute cluster boundary -> size for spill -> scale out for queues -> suspend cache tradeoff -> metering check [SF_01_Architecture_Core.md:192].
Q4: What is a Virtual Warehouse? Explain sizing and multi-cluster.
Simple Explanation:
A Virtual Warehouse is the compute in Snowflake β a cluster of cloud VMs (servers) that execute your queries. You size it (XS, S, M, L, XL, 2XL, 3XL, 4XL), it auto-starts when a query arrives, runs the query, and auto-suspends when idle. You pay only when it's running.
Real-world analogy: A virtual warehouse is like a team of analysts in an office. XS = 1 analyst, XL = 32 analysts. They all work on the same data files (the library). When no queries come in, they go home (auto-suspend). When a query arrives, they come back (auto-resume). You pay only for the hours they work.
Sizing:
π§ SIZE β T-SHIRT SIZE β SNOWFLAKE CREDITS/HOUR β BEST FOR
SIZET-SHIRT SIZE β SNOWFLAKE CREDITS/HOUR β BEST FOR
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
XSExtra Small β 1 credit/hour β Dev, small queries, testing
SSmall β 2 credits/hour β Light BI queries
MMedium β 4 credits/hour β Most BI/analytics workloads
LLarge β 8 credits/hour β Heavy queries, large datasets
XLExtra Large β 16 credits/hour β Complex joins, large MERGE
2XLβ2X Large β 32 credits/hour β Very large ETL, ML feature prep
3XLβ3X Large β 64 credits/hour β Data science at scale
4XLβ4X Large β 128 credits/hour β Extreme workloads
RULE: Each size-up = 2x the credits + 2x the compute power (roughly 2x faster)
Multi-Cluster Warehouse:
Current defaults matter: MIN_CLUSTER_COUNT = 1 and MAX_CLUSTER_COUNT = 1 produce a single-cluster warehouse. Setting MIN_CLUSTER_COUNT less than MAX_CLUSTER_COUNT enables auto-scale mode; a maximum above 1 requires Enterprise Edition or higher. See CREATE WAREHOUSE.
CREATE WAREHOUSE bi_dashboard_wh
WAREHOUSE_SIZE = 'MEDIUM'
MIN_CLUSTER_COUNT = 1
MAX_CLUSTER_COUNT = 5
SCALING_POLICY = 'STANDARD';
ALTER WAREHOUSE bi_dashboard_wh SET AUTO_SUSPEND = 300;
ALTER WAREHOUSE bi_dashboard_wh SET AUTO_RESUME = TRUE;
Scaling UP vs Scaling OUT:
| Scale UP | Scale OUT |
|---|
| What | Bigger size (M β L β XL) | More clusters (1β2β3) |
| Fixes | Slow queries (one complex query) | Queue (many users waiting) |
| Example | Slow JOIN on 10B rows | 100 analysts hitting dashboard at once |
| Cost | Higher credits/hour | More clusters Γ credits/hour |
Interview tip: "For the company's BI dashboards with 200+ analysts, I'd use a multi-cluster warehouse (MIN=1, MAX=5) with ECONOMY scaling. For overnight ETL jobs, I'd use a single Large or XL warehouse since it's one complex pipeline, not many concurrent users. Different workloads β different warehouses."
Answer First: Snowflake has 3 types of cache β each one faster than the previous, and free. When Snowflake runs your query, it checks cache first at each level before doing actual work.
Memory Map: Explain the 3 levels of Caching in Snowflake. -> persisted result reuse -> warehouse local disk -> remote storage cache -> invalidation triggers -> query history evidence [SF_01_Architecture_Core.md:255].
Q5: Explain the 3 levels of Caching in Snowflake.
Simple Explanation:
Snowflake has 3 types of cache β each one faster than the previous, and free. When Snowflake runs your query, it checks cache first at each level before doing actual work.
Real-world analogy:
- Level 1 (Result Cache): Your professor asks the same exam question twice. You just say the same answer β no need to re-think.
- Level 2 (Local Disk Cache): You already have the book open at the right page β read from there.
- Level 3 (Remote Disk Cache): You know which shelf the book is on β much faster than searching the whole library.
π§ QUERY ARRIVES β CHECK CACHE LEVEL 1 (Result Cache)
QUERY ARRIVESCHECK CACHE LEVEL 1 (Result Cache)
β βββ HIT: Return exact same result (free, instant!)
β β 24 hours TTL, invalidated if data changes
β βββ MISS: Check Level 2
β
ββββββββββββββββCHECK CACHE LEVEL 2 (Local Disk / SSD Cache)
β βββ HIT: Return from virtual warehouse SSD (fast!)
β β Lost when warehouse suspends
β βββ MISS: Check Level 3
β
ββββββββββββββββREAD FROM STORAGE (Remote / S3/ADLS)
Always available, slowest, but micro-partition pruning helps
Technical details:
π§ Memory Map
LEVEL 1: RESULT CACHE (Cloud Services Layer)
ββββββββββββββββββββββββββββββββββββββββββββ
WHERE: Stored in Cloud Services layer (always on)
WHAT: Exact query results from previous runs
DURATION: 24 hours (reset if underlying data changes)
FREE: Yes β no warehouse credits charged!
GOTCHA: Same SQL + same data = cache hit. One space differenceβcache miss.
9:00 AM: SELECT SUM(amount) FROM bookings WHERE date='2026-03-25'
β Runs on warehouse, takes 30 seconds
9:30 AM: Same query by different user
β Instant! Returns from Result Cache. Zero credits used.
LEVEL 2: LOCAL DISK CACHE (Virtual Warehouse SSD)
ββββββββββββββββββββββββββββββββββββββββββββββββββ
WHERE: SSD attached to each warehouse cluster node
WHAT: Raw micro-partition data that was recently read from storage
DURATION: As long as warehouse is running (cleared on suspend!)
FREE: Yes β no extra cost, but warehouse must be running
GOTCHA: If you suspend + resume warehouseβcache is GONE.
Set AUTO_SUSPEND to longer duration for frequently-hit tables.
LEVEL 3: REMOTE DISK / STORAGE (S3/ADLS)
βββββββββββββββββββββββββββββββββββββββββ
WHERE: Cloud object storage (AWS S3, Azure ADLS Gen2, GCS)
WHAT: All micro-partitions of all tables
ALWAYS AVAILABLE: Yes β never clears
COST: Storage cost per TB/month + data transfer
β οΈ Common trap: "If you suspend and resume a warehouse, the Level 2 local cache is CLEARED. For dashboards with repeated queries, keep the warehouse running with a longer auto-suspend (15-30 min) so the local cache stays warm."
Answer First: Fail-safe = an emergency recovery window AFTER time travel ends. Only Snowflake support can use it.
Memory Map: What is Time Travel? What is Fail-safe? -> retention window -> historical query -> undrop recovery -> fail-safe support path -> storage tradeoff [SF_01_Architecture_Core.md:319].
Q6: What is Time Travel? What is Fail-safe?
Simple Explanation:
Time Travel = ability to query your data as it was in the past (up to 90 days). "Show me the bookings table as it was yesterday at 3 PM."
Fail-safe = an emergency recovery window AFTER time travel ends. Only Snowflake support can use it.
Real-world analogy:
- Time Travel = a "rewind" button. You can rewind your table to any point in the past (within the retention window) and read it.
- Fail-safe = the data recovery team at your cloud provider. After your rewind window closes, they still have the data locked away for 7 more days (but only THEY can access it for disaster recovery).
SELECT * FROM bookings
AT (TIMESTAMP => '2026-03-20 09:00:00'::TIMESTAMP_LTZ);
SELECT * FROM bookings AT (OFFSET => -60 * 30);
SELECT * FROM bookings
BEFORE (STATEMENT => '8e5d0ca9-005e-44e6-b858-a8f5b37c5726');
UNDROP TABLE bookings;
CREATE OR REPLACE TABLE bookings CLONE bookings
AT (TIMESTAMP => '2026-03-24 00:00:00'::TIMESTAMP_LTZ);
SELECT a.booking_id, a.amount as old_amount, b.amount as new_amount
FROM bookings AT (TIMESTAMP => '2026-03-24 00:00:00') a
JOIN bookings AT (TIMESTAMP => '2026-03-25 00:00:00') b
ON a.booking_id = b.booking_id
WHERE a.amount != b.amount;
Time Travel vs Fail-safe:
π Architecture Diagram
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Timeline of a table after DELETION: β
β β
β [Data Deleted]ββββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββ 0-90 days: TIME TRAVEL (YOU can access) β
β β Default: 1 day (free plan), up to 90 days (paid) β
β β You can: UNDROP, query old data, clone old version β
β β β
β βββ 90-97 days: FAIL-SAFE (SNOWFLAKE SUPPORT only) β
β 7 days fixed β you cannot access directly β
β Only for catastrophic disasters (entire account wipe)β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
SET TIME TRAVEL on a table:
ALTER TABLE bookings SET DATA_RETENTION_TIME_IN_DAYS = 30;
-- 30 days for production tables (costs more storage)
-- 0 days for staging/temp tables (saves storage)
Interview tip: "For travel booking tables, I'd set time travel to 30 days for production tables β covers month-end reporting cycles. For temp/staging tables, I'd set it to 0 to save storage costs. And I'd document that fail-safe exists but only Snowflake support can use it β it's NOT a self-service feature."
Answer First: Zero-Copy Clone = instantly create an exact copy of a table, schema, or database β without copying ANY data. The clone points to the same micro-partitions as the original. Storage is only used when data in the clone DIVERGES from the original.
Memory Map: What is Zero-Copy Cloning? -> metadata pointer copy -> shared partitions -> copy-on-write delta -> retention dependency -> dev isolation [SF_01_Architecture_Core.md:385].
Q7: What is Zero-Copy Cloning?
Simple Explanation:
Zero-Copy Clone = instantly create an exact copy of a table, schema, or database β without copying ANY data. The clone points to the same micro-partitions as the original. Storage is only used when data in the clone DIVERGES from the original.
Real-world analogy: Imagine making a "copy" of a 10 TB hard drive, but instead of actually copying 10 TB of data, you just create a new label that says "copy of drive A". When someone writes new data to the copy, THAT new data is stored separately. But unchanged data is shared β no extra storage.
CREATE TABLE bookings_dev CLONE bookings;
CREATE SCHEMA analytics_dev CLONE analytics_prod;
CREATE DATABASE prod_backup CLONE prod_db;
CREATE TABLE bookings_march_snapshot CLONE bookings
AT (TIMESTAMP => '2026-03-01 00:00:00'::TIMESTAMP_LTZ);
When to use:
- Dev/test environments: Clone prod database for developers β no data copying, instant
- Data experiments: Clone table before a risky transformation β easy rollback
- Monthly snapshots: Clone at month-end for point-in-time reporting
- Parallel pipelines: Two teams working on different transformations of same data
β οΈ Common trap: "Zero-copy means zero INITIAL copy. But over time, as data in the clone changes, it diverges and uses its own storage for the changed micro-partitions. If you write a lot to the clone, storage cost grows."
Answer First: VARIANT is Snowflake's special data type for storing ANY semi-structured data β JSON, Avro, Parquet, ORC, XML β in a single column. Instead of flattening JSON into separate columns before loading (which is hard), you load it as-is into a VARIANT column and query it with dot notation.
Memory Map: What is VARIANT? How does Snowflake handle semi-structured data? -> raw JSON landing -> dot path extraction -> lateral FLATTEN arrays -> cast typed columns -> null semantics check [SF_01_Architecture_Core.md:420].
Q8: What is VARIANT? How does Snowflake handle semi-structured data?
Simple Explanation:
VARIANT is Snowflake's special data type for storing ANY semi-structured data β JSON, Avro, Parquet, ORC, XML β in a single column. Instead of flattening JSON into separate columns before loading (which is hard), you load it as-is into a VARIANT column and query it with dot notation.
Real-world analogy: VARIANT is like a "whatever" drawer. Instead of sorting everything before putting it in the drawer (JSON key1 β column1, key2 β column2), you just throw the whole JSON document in. Then when you need something, you reach in and say "give me the .passenger.email" and Snowflake finds it.
CREATE TABLE raw_bookings (
load_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
source VARCHAR(50),
raw_data VARIANT
);
COPY INTO raw_bookings (source, raw_data)
FROM (
SELECT 'booking_api', PARSE_JSON($1)
FROM @booking_stage/bookings.json
);
SELECT
raw_data:booking_id::VARCHAR AS booking_id,
raw_data:passenger.first_name::VARCHAR AS passenger_name,
raw_data:segments[0]:origin::VARCHAR AS departure_airport,
raw_data:segments[0]:destination::VARCHAR AS arrival_airport,
raw_data:fare.amount::NUMBER(10,2) AS fare_amount
FROM raw_bookings
WHERE raw_data:status::VARCHAR = 'CONFIRMED';
SELECT
b.raw_data:booking_id::VARCHAR AS booking_id,
f.value:origin::VARCHAR AS segment_origin,
f.value:destination::VARCHAR AS segment_destination,
f.index AS segment_number
FROM raw_bookings b,
LATERAL FLATTEN(input => b.raw_data:segments) f;
New in 2025-2026: Structured ARRAY, OBJECT, MAP types
CREATE TABLE bookings_v2 (
booking_id VARCHAR,
segments ARRAY(OBJECT(origin VARCHAR, destination VARCHAR, duration INT)),
tags MAP(VARCHAR, VARCHAR)
);
Interview tip: "I'd load raw JSON into VARIANT at Bronze layer β no schema definition needed. Then at Silver layer, use FLATTEN and dot notation to extract and cast into proper typed columns. This way Bronze handles any schema change gracefully, and Silver catches quality issues."
Answer First: A Stage in Snowflake is a pointer to a location where files live before or after file-based loading. Think of it as a "loading dock" β staged files sit in the dock, then COPY INTO or Snowpipe loads them into Snowflake tables; Snowpipe Streaming and direct row ingestion use API channels instead of staged files.
Memory Map: What are Stages? Internal vs External? -> file location pointer -> internal or external storage -> credential boundary -> COPY/Snowpipe consumer -> streaming exception [SF_01_Architecture_Core.md:493].
Q9: What are Stages? Internal vs External?
Simple Explanation:
A Stage in Snowflake is a pointer to a location where files live before or after file-based loading. Think of it as a "loading dock" β staged files sit in the dock, then COPY INTO or Snowpipe loads them into Snowflake tables. API-based row ingestion such as Snowpipe Streaming uses channels instead of staged files.
Real-world analogy: A stage is like the receiving dock of a warehouse. Trucks (data sources) drop files at the dock (stage). The warehouse workers (COPY INTO) pick up files from the dock and put them in the shelves (tables). The dock can be Snowflake's own parking lot (internal stage) or an external parking lot you own (external stage like ADLS/S3).
PUT file:///local/bookings.csv @~;
LIST @~;
COPY INTO bookings FROM @~/bookings.csv;
PUT file:///local/bookings.csv @%bookings;
COPY INTO bookings FROM @%bookings;
CREATE STAGE internal_booking_stage
COMMENT = 'Internal stage for booking files';
PUT file:///local/bookings_*.csv @internal_booking_stage;
COPY INTO bookings FROM @internal_booking_stage PATTERN='.*bookings.*\\.csv';
CREATE STAGE azure_booking_stage
URL = 'azure://mystorageaccount.blob.core.windows.net/bookings-container/landing/'
CREDENTIALS = (AZURE_SAS_TOKEN = 'sv=2020-08...')
FILE_FORMAT = (TYPE = 'PARQUET');
COPY INTO bookings FROM @azure_booking_stage;
Internal vs External Stage comparison:
| Internal Stage | External Stage |
|---|
| Data stored | Snowflake's managed storage | Your S3/ADLS/GCS |
| Control | Snowflake manages it | You manage it |
| Egress cost | No egress to load | May incur egress if cross-region |
| Sharing | Only inside Snowflake | External tools can also access it |
| Best for | Small/simple loads, testing | Production ETL where pipeline writes to ADLS |
Answer First: Standard Basic features. Enterprise Time Travel up to 90 days, multi-cluster warehouses, materialized views. Business Critical HIPAA/PCI compliance, private link, column-level security, tri-secret secure.
Memory Map: [DIRECT] Common Basic Questions -> layer separation -> partition pruning cue -> warehouse scaling cue -> cache caveat -> recovery terms [SF_01_Architecture_Core.md:549].
Q10: [DIRECT] Common Basic Questions
π What is Snowflake edition difference (Standard, Enterprise, Business Critical)?
Standard β Basic features. Enterprise β Time Travel up to 90 days, multi-cluster warehouses, materialized views. Business Critical β HIPAA/PCI compliance, private link, column-level security, tri-secret secure.
π What cloud providers does Snowflake support?
AWS, Azure, and GCP. When you create a Snowflake account, you choose the cloud + region. Data stored in that cloud's object storage (S3/ADLS/GCS).
π What is the difference between a database, schema, and table in Snowflake?
Database β top-level container (like a folder). Schema β sub-container inside a database. Table β data object inside a schema. Full path: database.schema.table.
π What is an Account Identifier?
Unique identifier for your Snowflake account β format: orgname-accountname (e.g., travelco-prod). Used in JDBC URLs and Snowpark connections.
π What is SnowSQL?
Snowflake's command-line SQL client. Connect to Snowflake, run queries, load data β all from terminal. Alternative to the Snowflake web UI.
SECTION 2: SNOWFLAKE vs DATABRICKS (Critical Comparison)
Answer First: Snowflake is SQL- and warehouse-oriented while Databricks is strongest for open lakehouse engineering and ML; choose by workload, governance, interoperability, and operating model.
Memory Map: Snowflake vs Databricks β When to use which? -> analyst SQL favors warehouse isolation -> Python ML favors lakehouse engines -> openness and operating model break ties [SF_01_Architecture_Core.md:570].
Q11: Snowflake vs Databricks β When to use which?
Simple Explanation:
This is the #1 comparison question you'll get since you're preparing for both. They solve DIFFERENT problems β they're often used TOGETHER in modern data platforms.
βββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββ
WHAT IT IS: WHAT IT IS:
Cloud Data WAREHOUSE Data Lakehouse (lake + warehouse)
SQL-first platform Python/Scala/R + SQL platform
Fully managed SaaS Open-source foundation (Apache Spark)
BEST AT: BEST AT:
SQL analytics & BI Complex ETL/ELT pipelines
Concurrent multi-user queries Machine learning & AI/ML
Data sharing with partners Streaming data (Kafka β Delta)
Semi-structured data (VARIANT) Python data engineering
Zero-copy cloning Large-scale batch processing
STORAGE: STORAGE:
Proprietary micro-partitions Open format: Delta Lake (Parquet)
Automatic management You manage: OPTIMIZE, VACUUM
Not portable to other tools Portable β any tool can read Parquet
COMPUTE: COMPUTE:
Virtual Warehouses (SQL engine) Apache Spark (distributed processing)
Pure SQL, no code needed Python/Scala DataFrames + SQL
Auto-scales by default Manual cluster configuration
NEW FEATURES 2026: NEW FEATURES 2026:
Cortex AI (LLM in SQL) Lakeflow Declarative Pipelines
Snowflake Postgres (managed PG) Serverless Workspaces
Hybrid Tables / Unistore Lakebase (OLTP on Delta)
Open Catalog (Polaris/Iceberg) Multi-table Transactions
Gen2 Warehouses (designed for workload-dependent performance improvements) Predictive Optimization
PRICING: PRICING:
Credits (per second of compute) DBUs (per second of compute)
Storage separate (per TB) Storage + compute separate
No cluster management overhead Cluster startup time (~2-10 min)
When to use Snowflake:
- BI dashboards with 100+ concurrent users
- SQL analysts without engineering skills
- Data sharing with external partners
- Mixed JSON + structured data analytics
- When you want zero infrastructure management
When to use Databricks:
- Complex Python ETL (pandas, PySpark)
- Machine learning pipeline + MLflow
- Streaming data from Kafka
- You need open-source portability
- Large-scale data transformation (not just querying)
Real-world at a large enterprise: "Databricks handles the heavy ingestion and transformation (Oracle CDC β Kafka β Bronze β Silver layers). The clean Silver data is then shared with Snowflake for BI analysts to query with SQL. Both tools, one pipeline."
Interview tip: "Snowflake and Databricks are complementary, not competing. I'd use Databricks for the data engineering heavy lifting and Snowflake for SQL-heavy analytics and partner data sharing. Many enterprise platforms today use both."
SECTION 3: SCENARIO-BASED QUESTIONS
Answer First: Ingest partner files through external stages and streaming events through Snowpipe Streaming, isolate ETL, BI, pricing, and data-science compute, then enforce airline row policies, PII masking, and governed shares.
Memory Map: Scenario β Design a Snowflake architecture for a travel platform's booking analytics -> batch and streaming paths land raw facts -> workload warehouses isolate contention -> policies and shares constrain partner access [SF_01_Architecture_Core.md:635].
Context: 10 billion bookings/year, 200+ airline partners, 500 BI analysts, GDPR compliance, real-time pricing queries, historical reporting up to 5 years.
Answer:
π Architecture Diagram
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TRAVEL PLATFORM SNOWFLAKE ANALYTICS β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β INGESTION: β
β Databricks Silver tables β Snowflake via Snowpipe Streaming β
β Partner files (CSV/JSON) β External Stage (ADLS) β COPY INTO β
β Real-time prices (Kafka) β Snowpipe (auto-ingest) β
β β
β DATABASES: β
β RAW_DB β Bronze (raw data, 90-day time travel) β
β ANALYTICS_DB β Silver/Gold (clean data, 30-day time travel) β
β SHARE_DB β Partner-specific views (data sharing) β
β β
β VIRTUAL WAREHOUSES (workload isolation): β
β ETL_WH β XL, loading & transformation (overnight) β
β BI_WH β M, multi-cluster (1-10), BI analysts (9-6 PM) β
β PRICING_WH β L, real-time fare queries (always on) β
β DS_WH β XL, data science queries (on demand) β
β β
β CLUSTERING KEYS: β
β bookings_fact: CLUSTER BY (booking_date, airline_code) β
β passengers: CLUSTER BY (passenger_id) β
β β
β SECURITY: β
β Unity hierarchy: ACCOUNTADMIN > SYSADMIN > team roles β
β Column masking: email, phone, passport_no (PII/GDPR) β
β Row access policies: each airline sees only their bookings β
β β
β SHARING: β
β Secure Share per airline β each airline's secure portal β
β Data Clean Room: cross-airline analysis without raw PII β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Answer First: Diagnose a slow query from Query History and Query Profile: separate queueing from execution time, inspect pruning and bytes scanned, locate spill or expensive operators, then benchmark one targeted change.
Memory Map: Scenario β Why is a specific query slow? How to diagnose? -> history separates queue from execution -> profile locates scan spill or join cost -> measured change confirms improvement [SF_01_Architecture_Core.md:678].
Q13: Scenario β Why is a specific query slow? How to diagnose?
SELECT query_id, query_text, total_elapsed_time/1000 as seconds,
bytes_scanned/1024/1024/1024 as gb_scanned,
partitions_scanned, partitions_total,
ROUND(partitions_scanned/partitions_total * 100, 1) as pct_scanned
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE user_name = 'ANALYST_USER'
ORDER BY total_elapsed_time DESC
LIMIT 10;
SELECT SYSTEM$CLUSTERING_INFORMATION('bookings', '(booking_date)');
SELECT * FROM TABLE(GET_QUERY_OPERATOR_STATS('query-id-here'));
SELECT query_id, warehouse_name, total_elapsed_time,
percentage_scanned_from_cache
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE query_id = 'your-query-id';
Snowflake exposes no dedicated persisted-result-reuse boolean in QUERY_HISTORY. A reused persisted result bypasses query execution; validate its documented eligibility conditions and inspect Query History/Query Profile rather than inventing a history flag. An executed query can separately read table data from the warehouse's local cache, measured by percentage_scanned_from_cache. See QUERY_HISTORY columns, persisted results, and warehouse data cache.
Day 1: Snowflake Architecture & Core β Quick Recall Guide
πΊοΈ Memory Map
How to use this file:
- β‘ = Must remember (95% chance of being asked)
- π = Key concept (core understanding needed)
- β οΈ = Common trap (interviewers love to test this)
- π§ = Memory Map (mnemonic/acronym β memorize this!)
- π = One-liner (flash-card style β cover answer, test yourself)
Reading strategy: Memory Maps FIRST β Direct Questions β Mid-Level
π§ MASTER MEMORY MAP β Day 1
π§ SNOWFLAKE ARCHITECTURE = "3 layers β CSC" (top to bottom)
SNOWFLAKE ARCHITECTURE"3 layers β CSC" (top to bottom)
CCloud Services (the BRAIN β managed by Snowflake; cloud-services billing follows the daily adjustment rules)
CCompute / Virtual Warehouses (the MUSCLES β pay when running)
SStorage (the FILING CABINET β always on, pay per TB)
Remember: "BMS" = Brain, Muscles, Storage (top β bottom)
VIRTUAL WAREHOUSE"VW" (like the car brand β sizes matter!)
XSS β M β L β XL β 2XL β 3XL β 4XL
For Gen1, each size step doubles credit rate; query speedup is workload-dependent
Each step OUT (multi-cluster) = handle more CONCURRENT users
CACHING"RLS" (Result, Local-disk, Storage)
RResult cache (24h, free, exact same query)
LLocal disk cache (SSD on warehouse, cleared on suspend)
SStorage (remote, always available, slowest)
Remember: "RLS" = ResultsβLocal β Storage (fast β slow)
MICRO-PARTITIONS = "Smart automatic drawers"
50-500 MB each
Columnar format
Automatic (NOT manual like Hive partitions)
Metadata: min/max per columnβpruning!
TIME TRAVEL + FAIL-SAFE = "TF-27"
TTime Travel (YOU access: 0-90 days, default 1 day)
FFail-safe (SNOWFLAKE access: 7 days after TT ends)
27 = 20 days TT + 7 days FS = max 97 days total protection
SECTION 1: ARCHITECTURE
π§ Memory Map: 3 Layers
LAYER 3 (TOP) = CLOUD SERVICES β "The Brain"
β Query parsing, optimization, execution planning
β Metadata management (table schemas, clustering info)
β Authentication, security (RBAC)
β Result Cache lives here
β Managed by Snowflake; cloud-services charges use a daily adjustment rather than a flat 10% cost
LAYER 2 (MIDDLE) = COMPUTE β "The Muscles"
β Virtual Warehouses β your clusters of VMs
β Execute SQL queries, load data
β Auto-suspend (stop paying when idle)
β Auto-resume (start on next query)
β Multiple warehouses share the SAME storage
LAYER 1 (BOTTOM) = STORAGE β "The Filing Cabinet"
β Micro-partitions (50-500 MB, columnar, compressed)
β Stores all table data + time travel versions
β Always ON (data always accessible)
β AWS S3 / Azure ADLS Gen2 / GCS underneath
β Charged per TB/month
KEY BENEFIT: Scale COMPUTE independently from STORAGE!
10 warehousesβall read same storage simultaneously β NO conflict
β‘ MUST KNOW DIRECT QUESTIONS
Answer First: A fully-managed cloud data warehouse with complete separation of storage and compute. Runs on AWS, Azure, or GCP. Uses SQL for all operations.
Memory Map: What is Snowflake? -> services coordinate metadata and security -> elastic warehouses process SQL -> shared storage preserves governed data [SF_01_Quick_Recall.md:87].
What is Snowflake?
A fully-managed cloud data warehouse with complete separation of storage and compute. Runs on AWS, Azure, or GCP. Uses SQL for all operations.
Answer First: 1. Cloud Services (brain β query parsing, auth, metadata, result cache).
Memory Map: What are the 3 layers of Snowflake? -> cloud services planner -> warehouse executors -> storage partitions -> cache interactions -> billing boundary [SF_01_Quick_Recall.md:90].
What are the 3 layers of Snowflake?
- Cloud Services (brain β query parsing, auth, metadata, result cache)
- Compute (virtual warehouses β run queries, auto-suspend/resume)
- Storage (micro-partitioned columnar data on S3/ADLS/GCS)
Answer First: Separation of compute and storage. Multiple virtual warehouses can query the same data at the same time without competing. Scale each independently. Pay only for compute when running.
Memory Map: What makes Snowflake different from traditional databases? -> centralized data outlives compute -> independent warehouses avoid resource contention -> suspension stops idle compute billing [SF_01_Quick_Recall.md:95].
What makes Snowflake different from traditional databases?
β
Pro Tip
Separation of compute and storage. Multiple virtual warehouses can query the same data at the same time without competing. Scale each independently. Pay only for compute when running.
Answer First: Automatically-created columnar storage units, each 50-500 MB compressed. Snowflake stores min/max metadata per column per partition β used for partition pruning to skip irrelevant data.
Memory Map: What are micro-partitions? -> automatic columnar chunks -> immutable range metadata -> scan pruning -> recluster when overlap grows -> profile bytes [SF_01_Quick_Recall.md:98].
What are micro-partitions?
Automatically-created columnar storage units, each 50-500 MB compressed. Snowflake stores min/max metadata per column per partition β used for partition pruning to skip irrelevant data.
Answer First: NO! Hive partitions = you manually define them, separate folders per value, you manage them. Micro-partitions = Snowflake creates automatically, fine-grained, stores min/max metadata, you never touch them. Much more efficient.
Memory Map: Are Snowflake micro-partitions the same as Hive partitions? -> folder keys contrast -> service-managed metadata -> no manual directories -> pruning without partition column -> storage transparency [SF_01_Quick_Recall.md:101].
Are Snowflake micro-partitions the same as Hive partitions?
NO! Hive partitions = you manually define them, separate folders per value, you manage them. Micro-partitions = Snowflake creates automatically, fine-grained, stores min/max metadata, you never touch them. Much more efficient.
Answer First: An optional column (or expression) that tells Snowflake how to organize micro-partitions. When data is clustered, similar values are in the same partition better pruning faster queries.
Memory Map: What is a clustering key? -> ordered co-location hint -> overlap score -> recluster threshold -> service credit decision -> validation query [SF_01_Quick_Recall.md:104].
What is a clustering key?
An optional column (or expression) that tells Snowflake how to organize micro-partitions. When data is clustered, similar values are in the same partition β better pruning β faster queries.
Answer First: Snowflake skips micro-partitions that cannot contain matching rows based on their min/max metadata. Example: WHERE date = '2026-03' skip all partitions where max_date < March.
Memory Map: What is partition pruning? -> predicate range lookup -> skipped partition count -> inspect profile scan -> fix non-sargable filters -> measure bytes [SF_01_Quick_Recall.md:107].
What is partition pruning?
Snowflake skips micro-partitions that cannot contain matching rows based on their min/max metadata. Example: WHERE date = '2026-03' β skip all partitions where max_date < March.
Answer First: A cluster of compute VMs that execute queries. You size it (XS to 4XL), it auto-starts when needed and auto-suspends when idle. Pay only when running.
Memory Map: What is a Virtual Warehouse? -> independent compute pool -> memory and CPU size -> suspend stops credits -> resume cold cache -> workload isolation [SF_01_Quick_Recall.md:110].
What is a Virtual Warehouse?
A cluster of compute VMs that execute queries. You size it (XS to 4XL), it auto-starts when needed and auto-suspends when idle. Pay only when running.
Answer First: A multi-cluster warehouse has MAX_CLUSTER_COUNT above 1. It auto-scales for concurrency only when MIN_CLUSTER_COUNT < MAX_CLUSTER_COUNT; the defaults are both 1, which remains single-cluster.
Memory Map: What is a multi-cluster warehouse? -> queue pressure signal -> add peer clusters -> keep per-query size -> concurrency not speedup -> max cluster guard [SF_01_Quick_Recall.md:113].
What is a multi-cluster warehouse?
A warehouse becomes multi-cluster when MAX_CLUSTER_COUNT is above 1. With MIN_CLUSTER_COUNT < MAX_CLUSTER_COUNT, Snowflake can add clusters for concurrency and remove them as load falls; both values default to 1, which is single-cluster.
Answer First: - Scale UP (bigger size: M L XL) = fix SLOW queries (one complex query needs more power).
Memory Map: Scale UP vs Scale OUT β what's the difference? -> larger cluster adds per-query resources -> additional clusters absorb concurrent queues -> history verifies the actual bottleneck [SF_01_Quick_Recall.md:116].
Scale UP vs Scale OUT β what's the difference?
- Scale UP (bigger size: MβLβXL) = fix SLOW queries (one complex query needs more power)
- Scale OUT (multi-cluster: 1β3β5 clusters) = fix QUEUE (many users waiting, not one slow query)
π MID-LEVEL QUESTIONS
Answer First: 1. SQL arrives Cloud Services layer parses + compiles it.
Memory Map: How does Snowflake read a query? (End-to-end flow) -> services parse authorize and optimize -> metadata prunes impossible partitions -> warehouse operators scan join and return results [SF_01_Quick_Recall.md:124].
How does Snowflake read a query? (End-to-end flow)
- SQL arrives β Cloud Services layer parses + compiles it
- Optimizer checks Result Cache β if hit, return immediately (free!)
- Optimizer builds physical plan (which micro-partitions to read, which to skip)
- Virtual warehouse is woken up (auto-resume if needed)
- Warehouse checks Local Disk Cache (SSD) for needed micro-partitions
- Missing micro-partitions fetched from Storage (S3/ADLS)
- Query executes, result returned to user
Answer First: The warehouse nodes (VMs) are stopped. The Local Disk Cache (SSD) is CLEARED. The next query triggers auto-resume (~5-15 seconds startup). Micro-partitions still in Storage β no data loss. Only the cache is lost.
Memory Map: What happens when warehouse is auto-suspended? -> credits stop -> local disk cache drops -> persisted results may remain -> resume latency -> idle policy [SF_01_Quick_Recall.md:133].
What happens when warehouse is auto-suspended?
The warehouse nodes (VMs) are stopped. The Local Disk Cache (SSD) is CLEARED. The next query triggers auto-resume (~5-15 seconds startup). Micro-partitions still in Storage β no data loss. Only the cache is lost.
Answer First: Start with Medium for most workloads. If query is slow, scale UP (L, XL). If many users are queuing, add clusters (multi-cluster). Use Query Profile to find if bottleneck is compute (scale up) or concurrency (scale out).
Memory Map: How to decide virtual warehouse size? -> spill symptom -> benchmark XS upward -> cache warmup control -> cost per query -> rollback size [SF_01_Quick_Recall.md:136].
How to decide virtual warehouse size?
Start with Medium for most workloads. If query is slow, scale UP (L, XL). If many users are queuing, add clusters (multi-cluster). Use Query Profile to find if bottleneck is compute (scale up) or concurrency (scale out).
Answer First: - Clustering depth = how many micro-partitions are stacked containing the same key value (lower = better, ideal = 1).
Memory Map: Explain clustering depth and overlap -> overlapping ranges -> depth score -> targeted key choice -> auto-clustering cost -> improvement proof [SF_01_Quick_Recall.md:139].
Explain clustering depth and overlap
- Clustering depth = how many micro-partitions are stacked containing the same key value (lower = better, ideal = 1)
- Clustering overlap = how many partitions contain overlapping value ranges
- Check with:
SYSTEM$CLUSTERING_INFORMATION('table', '(col)')
- High depth/overlap = poor clustering β queries scan too many partitions
SECTION 2: CACHING
π§ Memory Map: 3 Cache Levels
SPEED: Result Cache >>>>>> Local Disk Cache >>> Storage
(milliseconds) (seconds) (minutes for TB)
Duration: 24 hours
Cleared when: underlying data changes OR 24h pass
Cost: FREE (no warehouse needed!)
β οΈTRAP: Exact same SQL required. One extra space = cache miss!
β οΈTRAP: If table has any INSERT after the query β cache invalidated!
Duration: As long as warehouse is RUNNING
Cleared when: warehouse SUSPENDS (β οΈ important!)
Cost: Free (warehouse is already running)
β οΈTRAP: Keep warehouse running longer (higher AUTO_SUSPEND)
for frequently queried "hot" tables
Duration: Always there
Cost: Storage cost per TB/month
Speed: Slowest, but micro-partition pruning reduces data read
β‘ MUST KNOW DIRECT QUESTIONS
Answer First: 1. Result Cache (Cloud Services β 24h, free, same query returns instantly).
Memory Map: What are the 3 caching levels in Snowflake? -> result set reuse -> local disk blocks -> remote storage services -> TTL and mutation invalidators -> profile evidence [SF_01_Quick_Recall.md:179].
What are the 3 caching levels in Snowflake?
- Result Cache (Cloud Services β 24h, free, same query returns instantly)
- Local Disk Cache (warehouse SSD β cleared on suspend)
- Storage (S3/ADLS β always available, slowest)
Answer First: When the exact same SQL is run again within 24 hours AND the underlying data hasn't changed. Returns instantly with ZERO compute credits.
Memory Map: When is Result Cache used? -> exact query signature -> unchanged data -> 24-hour reuse window -> no warehouse execution -> bypass proof [SF_01_Quick_Recall.md:184].
When is Result Cache used?
When the exact same SQL is run again within 24 hours AND the underlying data hasn't changed. Returns instantly with ZERO compute credits.
Answer First: 1. The underlying table data changed (INSERT/UPDATE/DELETE since last run).
Memory Map: Why might Result Cache NOT be used even for the same query? -> changed data or role -> nondeterministic function -> text mismatch -> warehouse executes -> diagnose miss [SF_01_Quick_Recall.md:187].
Why might Result Cache NOT be used even for the same query?
- The underlying table data changed (INSERT/UPDATE/DELETE since last run)
- The SQL text is different (even one space, different case, different parameter)
- 24 hours have passed
- Non-deterministic functions used (CURRENT_TIMESTAMP, RANDOM())
Answer First: Local Disk Cache (Level 2) is completely cleared. Next query after resume reads from Storage again. Result Cache (Level 1) is unaffected β it's in Cloud Services layer.
Memory Map: What happens to cache when warehouse is suspended? -> suspend event -> local SSD cleared -> persisted results separate -> cold scan risk -> warmup test [SF_01_Quick_Recall.md:193].
What happens to cache when warehouse is suspended?
Local Disk Cache (Level 2) is completely cleared. Next query after resume reads from Storage again. Result Cache (Level 1) is unaffected β it's in Cloud Services layer.
SECTION 3: TIME TRAVEL & CLONING
π§ Memory Map: Time Travel
π§ TIME TRAVEL = "3 ways to go back in time"
TIME TRAVEL"3 ways to go back in time"
AT (TIMESTAMP => ...) β go to exact time
AT (OFFSET => -3600) β go back N seconds
BEFORE (STATEMENT => 'query-id') β go to just BEFORE that query ran
Standard edition: 0-1 days
Enterprise+: 0-90 days (default 1 day)
Temp tables: Always 0 days (can't change)
AFTER TIME TRAVEL: FAIL-SAFE (7 days, Snowflake only, not self-service)
UNDROP TABLE name;βrecover dropped table (within TT window)
RESTOREclone from past snapshot: CREATE TABLE t CLONE t AT (...)
ZERO-COPY CLONE = "Instant copy, no data duplicated"
CREATE TABLE dev_bookings CLONE prod_bookings;
β Takes < 1 second regardless of size
β Shares micro-partitions with original
β Storage used only when clone DIVERGES from original
β‘ MUST KNOW DIRECT QUESTIONS
Answer First: Ability to query, clone, or restore Snowflake data as it was at any point within the retention period (0-90 days). Works because Snowflake keeps old micro-partitions.
Memory Map: What is Time Travel? -> historical table versions -> AT BEFORE query -> retention window -> fail-safe boundary -> recovery drill [SF_01_Quick_Recall.md:230].
What is Time Travel?
Ability to query, clone, or restore Snowflake data as it was at any point within the retention period (0-90 days). Works because Snowflake keeps old micro-partitions.
Answer First: 1 day. Can be set 0-90 days with Enterprise+ edition. Set per-table: ALTER TABLE t SET DATA_RETENTION_TIME_IN_DAYS = 30.
Memory Map: What is the default time travel period? -> one-day default -> edition range -> object override -> storage impact -> restore expectation [SF_01_Quick_Recall.md:233].
What is the default time travel period?
1 day. Can be set 0-90 days with Enterprise+ edition. Set per-table: ALTER TABLE t SET DATA_RETENTION_TIME_IN_DAYS = 30.
Answer First: - Time Travel (0-90 days) YOU can access, query, restore yourself.
Memory Map: What is the difference between Time Travel and Fail-safe? -> self-service window -> Snowflake support window -> no fail-safe querying -> restore path choice -> compliance note [SF_01_Quick_Recall.md:236].
What is the difference between Time Travel and Fail-safe?
- Time Travel (0-90 days) β YOU can access, query, restore yourself
- Fail-safe (7 days after TT ends) β ONLY Snowflake support can recover, not self-service, for disasters only
Answer First: CREATE TABLE clone CLONE original β instantly creates a copy that shares all micro-partitions with the original. No data is duplicated at creation. Storage only grows when clone data diverges.
Memory Map: What is Zero-Copy Cloning? -> instant object fork -> shared micro-partitions -> write divergence -> storage grows on change -> sandbox cleanup [SF_01_Quick_Recall.md:240].
What is Zero-Copy Cloning?
CREATE TABLE clone CLONE original β instantly creates a copy that shares all micro-partitions with the original. No data is duplicated at creation. Storage only grows when clone data diverges.
Answer First: 1. Instant dev/test environments from prod (no wait, no cost).
Memory Map: What are the use cases for Zero-Copy Clone? -> dev branch snapshot -> testing isolation -> backup rehearsal -> shared storage caveat -> cleanup owner [SF_01_Quick_Recall.md:243].
What are the use cases for Zero-Copy Clone?
- Instant dev/test environments from prod (no wait, no cost)
- Point-in-time snapshots for month-end reporting
- Safe experimentation β clone before risky transformation, easy rollback
- Parallel development β two teams work on same data independently
SECTION 4: SEMI-STRUCTURED DATA
π§ Memory Map: VARIANT
π§ VARIANT = "The 'whatever' column β accepts any JSON/Avro/Parquet"
VARIANT"The 'whatever' column β accepts any JSON/Avro/Parquet"
col:keyβAccess JSON key (dot notation)
col:nested.keyβNested access
col:array[0]βArray element (0-indexed)
col:key::VARCHARβCast to SQL type (always needed!)
FLATTEN"Explode arrays into rows" (like explode() in Spark)
LATERAL FLATTEN(input => col:array_field) f
f.valueβthe element, f.index β position, f.key β key (for objects)
2025-2026 NEW: Typed structured columns
ARRAY(OBJECT(col1 TYPE, col2 TYPE))βvalidated schema + better perf
MAP(VARCHAR, VARCHAR)βkey-value typed pairs
Still use VARIANT for fully flexible/unknown schemas
β‘ MUST KNOW DIRECT QUESTIONS
Answer First: Snowflake's data type for semi-structured data (JSON, Avro, Parquet, ORC). Stores any structure in one column β no schema definition needed. Max 128 MB per value (expanded in 2025).
Memory Map: What is the VARIANT data type? -> semi-structured cell -> schema-later pattern -> mixed-type risk -> typed alternatives -> bronze fit [SF_01_Quick_Recall.md:278].
What is the VARIANT data type?
Snowflake's data type for semi-structured data (JSON, Avro, Parquet, ORC). Stores any structure in one column β no schema definition needed. Max 128 MB per value (expanded in 2025).
Answer First: Using colon notation + cast: raw_data:passenger.email::VARCHAR β reads the email field inside passenger object and casts to VARCHAR.
Memory Map: How do you access a JSON field from a VARIANT column? -> colon path syntax -> nested key traversal -> explicit cast -> missing key null -> projection test [SF_01_Quick_Recall.md:281].
How do you access a JSON field from a VARIANT column?
Using colon notation + cast: raw_data:passenger.email::VARCHAR β reads the email field inside passenger object and casts to VARCHAR.
Answer First: A Snowflake table function that converts an array or object inside a VARIANT column into multiple rows β one row per array element. Used with LATERAL FLATTEN(input => col:array_field).
Memory Map: What is FLATTEN? -> array explosion -> lateral join -> index and value columns -> preserve parent row -> rebuild grain [SF_01_Quick_Recall.md:284].
What is FLATTEN?
β
Pro Tip
A Snowflake table function that converts an array or object inside a VARIANT column into multiple rows β one row per array element. Used with LATERAL FLATTEN(input => col:array_field).
Answer First: VARIANT returns data in Snowflake's internal format. Without ::VARCHAR / ::NUMBER / ::DATE, comparisons may fail and values display oddly. Always cast: col:key::VARCHAR.
Memory Map: Why must you cast VARIANT values? -> typed comparisons -> BI display stability -> bad value errors -> TRY_CAST defense -> quality gate [SF_01_Quick_Recall.md:287].
Why must you cast VARIANT values?
VARIANT returns data in Snowflake's internal format. Without ::VARCHAR / ::NUMBER / ::DATE, comparisons may fail and values display oddly. Always cast: col:key::VARCHAR.
π§ FINAL REVISION β Day 1 Summary Card
π Architecture Diagram
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DAY 1: SNOWFLAKE ARCHITECTURE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 3 LAYERS = "BMS" (Brain, Muscles, Storage) β
β Cloud Services (brain) β Compute (muscles) β Storage (disk) β
β Key insight: storage & compute are SEPARATE β scale each alone β
β β
β MICRO-PARTITIONS = automatic, columnar, 50-500 MB β
β NOT like Hive partitions (those are manual, folder-based) β
β Metadata: min/max per column β partition PRUNING β
β Clustering key: optional hint to organize partitions β
β β
β VIRTUAL WAREHOUSE = compute cluster (XS to 4XL) β
β Scale UP (MβXL) = fix slow queries β
β Scale OUT (multi-cluster) = fix concurrency (many users) β
β Auto-suspend = stop billing when idle β
β β οΈ Suspend = Local Disk Cache CLEARED β
β β
β CACHING = "RLS" (Result, Local-disk, Storage) β
β Result Cache: 24h, free, exact SQL match required β
β Local Cache: cleared on suspend! β
β β
β TIME TRAVEL: 0-90 days (default 1 day) β
β FAIL-SAFE: 7 days after TT, Snowflake only (not self-service) β
β CLONE: instant copy, no data duplicated, shared micro-partitionsβ
β β
β VARIANT: store any JSON/semi-structured data β
β Access: col:key::VARCHAR (always cast!) β
β FLATTEN: array β rows (like Spark explode()) β
β β
β SNOWFLAKE vs DATABRICKS: β
β Snowflake = SQL warehouse, BI analytics, data sharing β
β Databricks = Python ETL, ML, streaming, open formats β
β Use BOTH: Databricks for ETL β Snowflake for analytics β
β β
β TOP 5 THINGS TO SAY IN INTERVIEW: β
β 1. "Separate compute & storage β multiple WH on same data" β
β 2. "Micro-partitions auto-created, pruning skips irrelevant" β
β 3. "Multi-cluster warehouse for 200+ concurrent BI analysts" β
β 4. "Result cache returns exact same query free in 24h" β
β 5. "Zero-copy clone: instant dev environment from prod" β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
πΊοΈ Memory Map
Study tip: Read Memory Maps + Direct Questions first (30 min), then Mid-Level (20 min). Before interview: Summary Card only (10 min).