Memory Atlas Β· Data processing

Snowflake

Build a durable mental model of how Spark plans, moves, and optimizes distributed workβ€”then retrieve it under interview pressure.

Chapters
06
Advanced
04
Mode
Recall

Read for structure. Pause at each memory map and answer before revealing the detail.

Foundation

Snowflake Overview and Interview Atlas

#

Snowflake Overview and Interview Atlas

Answer First: Snowflake separates managed storage, elastic compute, and cloud services so independent workloads can share governed data without sharing one compute cluster.

Memory Map: request -> cloud services -> virtual warehouse -> micro-partitions -> governed result.

Version and account guardrails

  • The legacy notes are a historical study snapshot. Product names, defaults, preview/GA status, region support, prices, and benchmark multipliers can change; verify the target account, cloud, region, edition, and current release documentation.
  • Gen2 standard warehouses are region-dependent, use generation-specific consumption rates, and do not guarantee a fixed speedup. Benchmark the workload and consult the current service-consumption table: official guide.
  • Standard Time Travel retention is one day; up to 90 days requires Enterprise Edition and eligible objects. Fail-safe and historical storage behavior also depend on table type: official guide.
  • Cloud-services compute is not a flat β€œ10% of the bill.” The daily adjustment applies when eligible cloud-services usage is below 10% of warehouse usage; serverless compute is treated separately: official cost guide.
  • Snowflake has organization, account, database, and application roles. The five-role mnemonic in the legacy notes refers only to the core account hierarchy; use custom roles and least privilege: official access-control guide.
  • File-based loading uses stages for files consumed by COPY INTO and Snowpipe; Snowpipe Streaming/direct row ingestion uses API channels instead of staged files: official loading overview.
  • Current high-performance Snowpipe Streaming guidance describes data becoming queryable within seconds, with latency as low as five secondsβ€”not a blanket sub-second SLA: official guide.
  • Dynamic-table TARGET_LAG is a best-effort staleness target, not a refresh interval or guarantee. AUTO is the default refresh mode and resolves at creation; production designs should inspect or set the resolved mode explicitly: target-lag guide, refresh-mode guide.
  • COPY INTO uses per-table file-load metadata to prevent recent duplicate loads, but that metadata expires after 64 days. FORCE can duplicate rows; use durable source identities and explicit replay controls: official loading guide.
  • Do not assume serverless tasks are a fixed percentage cheaper. Compare actual serverless-task metering with a representative user-managed warehouse run: official task guide.
  • Feature availability is account- and region-sensitive. For example, Snowflake Postgres became generally available on February 24, 2026, but the release note limits it to selected AWS and Azure regions: official release note.

Canonical module route

Answer First: The three-day plan moves from architecture and storage/compute separation to ingestion and performance, then closes with security, sharing, cost, and current-feature guardrails.

Memory Map: 3-Day Snowflake Interview Prep -> architecture establishes execution model -> pipelines establish data movement -> governance controls access and spend [SF_00_INTERVIEW_PLAN.md:5].

3-Day Snowflake Interview Prep

πŸ—ΊοΈ Memory Map
Focus: Snowflake platform β€” architecture, pipelines, performance, governance Created: 2026-03-25 Approach: Same as Databricks prep β€” basics embedded in questions, memory maps, 3 levels

WHY SNOWFLAKE MATTERS FOR YOUR INTERVIEW

  • Many JDs mention "BigQuery" and cloud data warehouses β€” Snowflake is the #1 cloud DW
  • Interviewers often ask: "Have you worked with Snowflake? How does it compare to Databricks?"
  • Even if your target company uses Databricks, knowing Snowflake shows breadth of data platform knowledge
  • Many companies use BOTH β€” Databricks for ETL/ML + Snowflake for analytics/BI

3-DAY SCHEDULE

πŸ—ΊοΈMemory Map
DAY 15-6 hoursARCHITECTURE & CORE CONCEPTS
Snowflake Architecture (3 layers: Storage, Compute, Cloud Services)
Micro-Partitions & Data Clustering
Virtual Warehouses (sizing, scaling, multi-cluster)
Caching (3 levels: Result, Local Disk, Remote Disk)
Time Travel & Fail-safe
Data Types (VARIANT, ARRAY, OBJECT, structured types)
Semi-Structured Data (FLATTEN, LATERAL, JSON/Parquet)
Snowflake vs Databricks (CRITICAL comparison question)
Stages (Internal, External, Named)
DAY 25-6 hoursDATA LOADING, PIPELINES & PERFORMANCE
COPY INTO (bulk loading β€” options, error handling)
Snowpipe (auto-ingest, REST API, Snowpipe Streaming)
Streams (CDC within Snowflake β€” Standard, Append-only)
Tasks (scheduled SQL, task trees, DAGs)
Dynamic Tables (auto-refreshing β€” is a managed-refresh alternative for eligible streams-and-tasks pipelines)
Snowpark (Python/Java/Scala on Snowflake β€” DataFrame API)
Performance Tuning (clustering keys, search optimization, query profiling)
Materialized Views
Query Optimization (pruning, pushdown, spilling)
Scenario: Design an ELT pipeline in Snowflake
DAY 35-6 hoursSECURITY, SHARING, COST & NEW FEATURES
RBAC (roles hierarchy, system roles, custom roles)
Data Masking (dynamic, static masking policies)
Row Access Policies (row-level security)
Network Policies & Private Link
Secure Data Sharing (shares, reader accounts, data clean rooms)
Snowflake Marketplace (data exchange)
Cost Management (warehouse sizing, auto-suspend, resource monitors)
NEW 2025-2026: Cortex AI, Iceberg Tables, Polaris Catalog
NEW 2025-2026: Gen 2 Warehouses, Snowpark Container Services
NEW 2025-2026: Unistore (Hybrid Tables), Native dbt
Snowflake vs Databricks β€” Detailed Comparison
Mock Interview Questions (10 most likely)

PRIORITY MATRIX

MUST KNOW (Will definitely be asked β€” 60%)

  1. Snowflake 3-layer architecture (storage, compute, cloud services)
  2. Micro-partitions & clustering keys
  3. Virtual warehouse sizing & multi-cluster warehouses
  4. Time Travel & cloning (zero-copy clone)
  5. Snowpipe & COPY INTO β€” data loading patterns
  6. Semi-structured data (VARIANT, FLATTEN)
  7. Snowflake vs Databricks β€” the #1 comparison question

SHOULD KNOW (High probability β€” 25%)

  1. Streams & Tasks (CDC + scheduling)
  2. Dynamic Tables (declarative managed refresh for eligible transformations)
  3. Caching (3 levels β€” result, local disk, remote disk)
  4. RBAC & role hierarchy (ACCOUNTADMIN, SYSADMIN, etc.)
  5. Data masking & row access policies
  6. Secure Data Sharing
  7. Cost management & resource monitors

NICE TO KNOW (Differentiators β€” 15%)

  1. Snowpark (Python DataFrame API on Snowflake)
  2. Cortex AI (LLM functions in SQL)
  3. Iceberg Tables & Polaris Catalog
  4. Snowpark Container Services
  5. Gen2 Warehouses (benchmark workload-specific performance and cost)
  6. Unistore / Hybrid Tables (OLTP on Snowflake)
  7. Native dbt integration

Each main section has:

  • 15-20 questions at all 3 levels (direct, mid-level, scenario-based)
  • Simple explanations with real-world analogies
  • Line-by-line commented code/SQL
  • Interview tips for each topic

Each Quick Recall File will have:

  • 🧠 Memory Maps (mnemonics, acronyms)
  • ⚑ Direct questions (one-liner flash cards)
  • πŸ”‘ Mid-level questions (how/why/compare)
  • ⚠️ Common traps
  • Summary card for last-minute revision

LEARNING APPROACH

Same as Databricks prep:

🧠 INTERVIEW TIP β†’ How to answer this confidently
WHAT IS IT?β†’Simple 2-3 line explanation in plain English
WHY DO WE NEED IT?β†’Real problem it solves (with travel/booking example)
HOW DOES IT WORK?β†’Technical details + SQL with comments on every line
WHEN TO USE / NOT USE?β†’Practical decision guide
INTERVIEW TIPHow to answer this confidently
MEMORY MAPMnemonic to never forget

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 β€” Quick Reference -> SQL analytics favors managed warehouses -> engineering and ML favor open lakehouse compute -> shared governance decides coexistence [SF_00_INTERVIEW_PLAN.md:125].

SNOWFLAKE vs DATABRICKS β€” Quick Reference

πŸ“ Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Aspect           β”‚ Snowflake           β”‚ Databricks          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Core strength    β”‚ Data Warehousing    β”‚ Data Engineering/ML β”‚
β”‚ Language         β”‚ SQL-first           β”‚ Python/Scala-first  β”‚
β”‚ Storage format   β”‚ Proprietary (micro) β”‚ Delta Lake (open)   β”‚
β”‚ Compute          β”‚ Virtual Warehouses  β”‚ Spark Clusters      β”‚
β”‚ Semi-structured  β”‚ VARIANT (native)    β”‚ JSON in Delta cols  β”‚
β”‚ Data sharing     β”‚ Secure Sharing      β”‚ Delta Sharing       β”‚
β”‚ ML/AI            β”‚ Cortex AI, Snowpark β”‚ MLflow, MLlib       β”‚
β”‚ CDC              β”‚ Streams             β”‚ CDF (Change Feed)   β”‚
β”‚ ELT framework    β”‚ Dynamic Tables      β”‚ Lakeflow (DLT)      β”‚
β”‚ File format      β”‚ Proprietary         β”‚ Open (Parquet/Delta)β”‚
β”‚ Governance       β”‚ Horizon Catalog     β”‚ Unity Catalog       β”‚
β”‚ Pricing          β”‚ Per-second credits  β”‚ Per-second DBUs     β”‚
β”‚ Best for         β”‚ SQL analytics/BI    β”‚ Complex ETL/ML      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

HOW TO USE

  1. Read SF_01/02/03 main files for deep understanding (questions + explanations + code)
  2. Read SF_01/02/03_Quick_Recall for memory maps and flash-card style review
  3. For last-minute: Read only Quick Recall Summary Cards (10 min per day)
  4. Always connect Snowflake to your Databricks knowledge: "I've used Databricks for X, and I know Snowflake handles this with Y"
  5. Frame with real-world context: "In a travel data warehouse with billions of booking records..."
Intermediate

Snowflake Architecture and Core Concepts

#

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:

πŸ—‚οΈSnowflake Table: bookings (10 billion rows)
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: ...
sql
-- Query: Get all Lufthansa bookings in March 2026
SELECT * FROM bookings
WHERE booking_date BETWEEN '2026-03-01' AND '2026-03-31'
  AND airline_code = 'LH';

-- What Snowflake does (PARTITION PRUNING):
-- 1. Reads metadata of ALL micro-partitions (from Cloud Services layer β€” fast!)
-- 2. Skips micro-partitions where max_date < March 1 OR min_date > March 31
-- 3. Of remaining, skips where 'LH' not in airlines list
-- 4. Reads ONLY relevant micro-partitions
-- Result: Instead of reading 10B rows, reads maybe 50M rows β†’ 200x faster!

Micro-partitions vs Hive/Databricks partitions:

FeatureSnowflake Micro-partitionsHive/Databricks Partitions
Created bySnowflake automaticallyYou must define manually
Granularity50-500 MB each (fine-grained)Entire folder per partition value
Too many?Never β€” Snowflake manages automaticallyYes β€” too many partitions = metadata overload
MetadataMin/max per column per micro-partitionJust folder structure
OverlapCan overlap (managed by clustering)No overlap by design
MaintenanceAutomatic (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.

sql
-- Create a table WITH clustering key (good for large tables queried by date)
CREATE TABLE bookings (
    booking_id      VARCHAR,
    booking_date    DATE,
    airline_code    VARCHAR,
    passenger_id    VARCHAR,
    amount          NUMBER
)
CLUSTER BY (booking_date, airline_code);
-- This tells Snowflake: "Group micro-partitions by booking_date first, then airline_code"
-- Snowflake will keep data with same booking_date in the same or nearby micro-partitions

-- Check clustering health of a table
SELECT SYSTEM$CLUSTERING_INFORMATION('bookings', '(booking_date, airline_code)');
-- Returns: average_depth (lower = better), average_overlaps (lower = better)

-- Manually trigger reclustering (usually not needed β€” it's automatic)
ALTER TABLE bookings RECLUSTER;

When to use clustering keys:

USE CLUSTERING KEY WHEN
βœ“ 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
DO NOT USE WHEN
βœ— 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.

sql
-- Create a multi-cluster warehouse for BI dashboards
-- (handles many users running queries simultaneously)
CREATE WAREHOUSE bi_dashboard_wh
    WAREHOUSE_SIZE = 'MEDIUM'
    MIN_CLUSTER_COUNT = 1     -- At minimum, 1 cluster running
    MAX_CLUSTER_COUNT = 5     -- Scale up to 5 clusters during peak load
    SCALING_POLICY = 'STANDARD';  -- Add clusters when there's queuing
-- 'ECONOMY' policy = add cluster only when existing cluster is fully busy for 6 min

-- When 50 BI users hit the dashboard at 9 AM:
-- Cluster 1 handles users 1-10
-- Cluster 2 auto-added for users 11-20  (scale-out!)
-- Cluster 3 auto-added for users 21-30
-- etc.
-- At 3 PM, usage drops β†’ clusters 2-5 auto-removed

-- Auto-suspend (stop billing after 5 minutes idle)
ALTER WAREHOUSE bi_dashboard_wh SET AUTO_SUSPEND = 300;  -- 300 seconds = 5 minutes

-- Auto-resume (start automatically when query arrives)
ALTER WAREHOUSE bi_dashboard_wh SET AUTO_RESUME = TRUE;

Scaling UP vs Scaling OUT:

Scale UPScale OUT
WhatBigger size (M β†’ L β†’ XL)More clusters (1β†’2β†’3)
FixesSlow queries (one complex query)Queue (many users waiting)
ExampleSlow JOIN on 10B rows100 analysts hitting dashboard at once
CostHigher credits/hourMore 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.
EXAMPLE
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).
sql
-- TIME TRAVEL EXAMPLES:

-- Query as of exact timestamp (useful for debugging)
SELECT * FROM bookings
AT (TIMESTAMP => '2026-03-20 09:00:00'::TIMESTAMP_LTZ);

-- Query as of N minutes ago
SELECT * FROM bookings AT (OFFSET => -60 * 30);  -- 30 minutes ago

-- Query as of a specific statement ID (query ID)
SELECT * FROM bookings
BEFORE (STATEMENT => '8e5d0ca9-005e-44e6-b858-a8f5b37c5726');

-- Restore an accidentally dropped table
UNDROP TABLE bookings;  -- Works within time travel window

-- Restore to a previous version (overwrite current with past version)
CREATE OR REPLACE TABLE bookings CLONE bookings
  AT (TIMESTAMP => '2026-03-24 00:00:00'::TIMESTAMP_LTZ);

-- See what changed between two points in time (audit)
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;  -- Find what changed!

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.

sql
-- Clone a table (instant, no data copied!)
CREATE TABLE bookings_dev CLONE bookings;
-- Creates bookings_dev that shares ALL micro-partitions with bookings
-- Takes < 1 second regardless of table size (10 GB or 10PB)!

-- Clone a schema (all tables in the schema, instantly)
CREATE SCHEMA analytics_dev CLONE analytics_prod;

-- Clone a database (all schemas + tables, instantly!)
CREATE DATABASE prod_backup CLONE prod_db;

-- Clone at a specific point in time (combine with time travel)
CREATE TABLE bookings_march_snapshot CLONE bookings
    AT (TIMESTAMP => '2026-03-01 00:00:00'::TIMESTAMP_LTZ);
-- Creates a copy as it was on March 1 β€” perfect for month-end snapshots

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.

sql
-- Create table with VARIANT column (for raw JSON data)
CREATE TABLE raw_bookings (
    load_time   TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    source      VARCHAR(50),
    raw_data    VARIANT    -- Can hold ANY JSON/Avro/Parquet structure
);

-- Load JSON data into VARIANT column
COPY INTO raw_bookings (source, raw_data)
FROM (
    SELECT 'booking_api', PARSE_JSON($1)   -- $1 = first column from file
    FROM @booking_stage/bookings.json
);

-- Query VARIANT data with dot notation (: or . both work)
SELECT
    raw_data:booking_id::VARCHAR           AS booking_id,
    -- ::VARCHAR casts the JSON value to the right SQL type
    raw_data:passenger.first_name::VARCHAR AS passenger_name,
    -- Nested object: passenger.first_name
    raw_data:segments[0]:origin::VARCHAR   AS departure_airport,
    -- Array access: segments[0] = first segment
    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';
-- Filter inside VARIANT with dot notation + cast

-- FLATTEN: Convert array inside JSON into rows
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;
-- LATERAL FLATTEN expands the "segments" array into separate rows
-- Each segment becomes its own row with booking_id repeated

-- Result:
-- booking_id  segment_origin  segment_destination  segment_number
-- BK001       DEL             DXB                  0
-- BK001       DXB             LHR                  1
-- BK002       BOM             SIN                  0

New in 2025-2026: Structured ARRAY, OBJECT, MAP types

sql
-- Instead of untyped VARIANT, Snowflake now supports typed structured types
-- These give better performance and compile-time schema checking

CREATE TABLE bookings_v2 (
    booking_id  VARCHAR,
    segments    ARRAY(OBJECT(origin VARCHAR, destination VARCHAR, duration INT)),
    -- Typed array of objects β€” Snowflake validates schema at insert time!
    tags        MAP(VARCHAR, VARCHAR)
    -- Key-value pairs with typed keys and values
);
-- Note: VARIANT still works and is more flexible. Typed arrays/objects are faster.

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).

sql
-- ══════════════════════════════════════════════════════
-- TYPE 1: USER STAGE (per-user, automatic, always exists)
-- ══════════════════════════════════════════════════════
-- Each user gets their own private stage: @~
PUT file:///local/bookings.csv @~;       -- Upload local file to your user stage
LIST @~;                                 -- See your files
COPY INTO bookings FROM @~/bookings.csv; -- Load into table

-- ══════════════════════════════════════════════════════
-- TYPE 2: TABLE STAGE (per-table, automatic, always exists)
-- ══════════════════════════════════════════════════════
-- Every table has a built-in stage: @%table_name
PUT file:///local/bookings.csv @%bookings;    -- Upload to bookings table's stage
COPY INTO bookings FROM @%bookings;           -- Load from table's stage

-- ══════════════════════════════════════════════════════
-- TYPE 3: NAMED STAGE (create your own β€” most flexible)
-- ══════════════════════════════════════════════════════

-- Internal Named Stage (files stored IN Snowflake's storage)
CREATE STAGE internal_booking_stage
    COMMENT = 'Internal stage for booking files';

PUT file:///local/bookings_*.csv @internal_booking_stage;  -- Upload CSV files
COPY INTO bookings FROM @internal_booking_stage PATTERN='.*bookings.*\\.csv';

-- External Named Stage (files in YOUR Azure ADLS / S3 / GCS)
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');
    -- Points to ADLS container where your pipeline drops files

COPY INTO bookings FROM @azure_booking_stage;  -- Load from ADLS

Internal vs External Stage comparison:

Internal StageExternal Stage
Data storedSnowflake's managed storageYour S3/ADLS/GCS
ControlSnowflake manages itYou manage it
Egress costNo egress to loadMay incur egress if cross-region
SharingOnly inside SnowflakeExternal tools can also access it
Best forSmall/simple loads, testingProduction 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.

SNOWFLAKE DATABRICKS
─────────────────────────────────── ─────────────────────────────────────
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].

Q12: Scenario β€” Design a Snowflake architecture for a travel platform's booking analytics

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?

sql
-- Step 1: Find the slow query in query history
SELECT query_id, query_text, total_elapsed_time/1000 as seconds,
       bytes_scanned/1024/1024/1024 as gb_scanned,
       partitions_scanned, partitions_total,
       -- Low ratio = bad pruning (scanning too many partitions)
       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;

-- Step 2: Check if clustering is helping
SELECT SYSTEM$CLUSTERING_INFORMATION('bookings', '(booking_date)');
-- Look at: average_depth (>6 = needs reclustering)
--          average_overlaps (>5 = partitions heavily mixed)

-- Step 3: Check execution details
SELECT * FROM TABLE(GET_QUERY_OPERATOR_STATS('query-id-here'));
-- Shows each operator: TableScan, Join, Aggregate
-- Find which step takes the most time

-- Step 4: Measure warehouse local-disk cache use for executed queries
SELECT query_id, warehouse_name, total_elapsed_time,
       percentage_scanned_from_cache
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE query_id = 'your-query-id';
-- percentage_scanned_from_cache measures table data read from the local
-- warehouse cache. It does NOT identify persisted-result reuse.

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?

  1. Cloud Services (brain β€” query parsing, auth, metadata, result cache)
  2. Compute (virtual warehouses β€” run queries, auto-suspend/resume)
  3. 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)

  1. SQL arrives β†’ Cloud Services layer parses + compiles it
  2. Optimizer checks Result Cache β†’ if hit, return immediately (free!)
  3. Optimizer builds physical plan (which micro-partitions to read, which to skip)
  4. Virtual warehouse is woken up (auto-resume if needed)
  5. Warehouse checks Local Disk Cache (SSD) for needed micro-partitions
  6. Missing micro-partitions fetched from Storage (S3/ADLS)
  7. 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)
RESULT CACHE (Level 1 β€” Cloud Services Layer)
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!
LOCAL DISK CACHE (Level 2 β€” Virtual Warehouse SSD)
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
STORAGE (Level 3 β€” S3/ADLS/GCS)
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?

  1. Result Cache (Cloud Services β€” 24h, free, same query returns instantly)
  2. Local Disk Cache (warehouse SSD β€” cleared on suspend)
  3. 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?

  1. The underlying table data changed (INSERT/UPDATE/DELETE since last run)
  2. The SQL text is different (even one space, different case, different parameter)
  3. 24 hours have passed
  4. 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
TIME TRAVEL DURATION
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)
COMMANDS
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?

  1. Instant dev/test environments from prod (no wait, no cost)
  2. Point-in-time snapshots for month-end reporting
  3. Safe experimentation β€” clone before risky transformation, easy rollback
  4. 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"
QUERY SYNTAX
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).
Advanced

Snowflake Loading, Pipelines, and Performance

#

Snowflake Loading, Pipelines, and Performance

Answer First: Choose ingestion by delivery contract, model change processing explicitly, and tune performance from Query Profile evidence before changing warehouse size or physical design.

Memory Map: stage -> ingest -> change capture -> transform -> profile -> tune -> monitor.

Day 2: Data Loading, Pipelines & Performance

βœ… Pro Tip
Time: 5-6 hours | Priority: HIGH β€” Pipelines & performance are 30-35% of interviews Context: Real-time booking ingestion, CDC from Oracle, BI dashboard performance Approach: Simple explanation β†’ analogy β†’ technical details β†’ code β†’ interview tip

SECTION 1: DATA LOADING (1 hour)

Answer First: COPY INTO is Snowflake's bulk loading command β€” it reads files from a stage (ADLS, S3, internal) and loads them into a table. It is MUCH faster than INSERT for large volumes because it runs in parallel across the warehouse.

Memory Map: What is COPY INTO? How is it different from INSERT? -> staged files feed parallel loaders -> table metadata tracks recent file loads -> row inserts suit only small direct writes [SF_02_Pipelines_Performance.md:11].

Q1: What is COPY INTO? How is it different from INSERT?

Simple Explanation: COPY INTO is Snowflake's bulk loading command β€” it reads files from a stage (ADLS, S3, internal) and loads them into a table. It is MUCH faster than INSERT for large volumes because it runs in parallel across the warehouse.

Why do we need it? INSERT processes rows one by one β€” fine for 100 rows, terrible for 100 million rows. COPY INTO parallelizes across the warehouse and processes files in parallel batches.

Real-world analogy: INSERT = one person typing data manually. COPY INTO = 100 workers simultaneously moving pallets from a loading dock into the warehouse.

sql
-- Basic COPY INTO from external stage (Azure ADLS)
COPY INTO raw_bookings
FROM @azure_booking_stage/2026/03/25/        -- Read from this ADLS path
FILE_FORMAT = (
    TYPE = 'PARQUET'                          -- File type
)
ON_ERROR = 'CONTINUE';                        -- Skip bad files, continue loading
-- Options: ABORT_STATEMENT (default), CONTINUE, SKIP_FILE

-- COPY INTO with transformation (load + clean in one step)
COPY INTO silver_bookings (booking_id, booking_date, amount, airline_code)
FROM (
    SELECT
        $1:booking_id::VARCHAR,               -- Cast from VARIANT
        $1:booking_date::DATE,
        $1:fare.amount::NUMBER(10,2),
        UPPER($1:airline_code::VARCHAR)        -- Transform during load
    FROM @azure_booking_stage/bookings.json
)
FILE_FORMAT = (TYPE = 'JSON');

-- COPY INTO with error handling β€” see what failed
COPY INTO raw_bookings FROM @stage/
ON_ERROR = 'CONTINUE';

-- After loading, check what errors occurred:
SELECT * FROM TABLE(VALIDATE(raw_bookings, JOB_ID => '_last'));
-- Shows exactly which files + rows failed and why

-- COPY INTO uses table load metadata to avoid recent duplicate file loads; this is not an unlimited idempotency guarantee
-- Snowflake tracks which files were already loaded (load history table)
-- Re-running the same COPY INTO skips already-loaded files automatically
-- To force reload: COPY INTO ... FORCE = TRUE;

Key COPY INTO options:

OptionValuesUse Case
ON_ERRORABORT / CONTINUE / SKIP_FILEHandle bad rows
PURGE = TRUEβ€”Auto-delete files from stage after loading
FORCE = TRUEβ€”Re-load already-loaded files
PATTERN = '.*\.csv'RegexLoad only matching file names
FILES = ('f1.csv','f2.csv')ListLoad specific files

Answer First: COPY INTO = you manually trigger the load (or schedule with a Task). Snowpipe = load happens AUTOMATICALLY when new files arrive. Snowpipe monitors your stage and runs COPY INTO for you the moment a new file appears.

Memory Map: What is Snowpipe? How does it differ from COPY INTO? -> file arrival event -> pipe COPY definition -> serverless load history -> latency and cost -> replay check [SF_02_Pipelines_Performance.md:69].

Q2: What is Snowpipe? How does it differ from COPY INTO?

Simple Explanation: COPY INTO = you manually trigger the load (or schedule with a Task). Snowpipe = load happens AUTOMATICALLY when new files arrive. Snowpipe monitors your stage and runs COPY INTO for you the moment a new file appears.

Real-world analogy: COPY INTO = you call a taxi (trigger manually). Snowpipe = Uber pool running continuously β€” jumps in automatically whenever you're ready (file arrives).

FILE ARRIVES IN ADLS/S3
↓
SNOWPIPE NOTIFICATION (via Azure Event Grid / AWS SQS)
↓ (seconds later)
SNOWPIPE COPIES FILE INTO TABLE
↓
TABLE IS UPDATED
Total latency: ~30 seconds to 1 minute
vs COPY INTO (batch):
CRON JOB RUNS EVERY 5 MINUTES
↓ "are there new files?"
COPY INTO runs for all new files
Total latency: up to 5 minutes
sql
-- Create a pipe that auto-loads from a stage
CREATE PIPE booking_pipe
    AUTO_INGEST = TRUE          -- Enabled for cloud event notifications
    AS
    COPY INTO raw_bookings      -- What to run when files arrive
    FROM @azure_booking_stage
    FILE_FORMAT = (TYPE = 'PARQUET');

-- Check pipe status
SELECT SYSTEM$PIPE_STATUS('booking_pipe');
-- Shows: pendingFileCount, lastIngestedTimestamp, status

-- See load history (what files loaded, errors)
SELECT * FROM TABLE(INFORMATION_SCHEMA.COPY_HISTORY(
    TABLE_NAME => 'raw_bookings',
    START_TIME => DATEADD('hour', -24, CURRENT_TIMESTAMP)
));

Snowpipe vs COPY INTO vs Snowpipe Streaming:

COPY INTO
βœ“ Batch: you trigger manually or via Task
βœ“ Cheapest option (uses your warehouse)
βœ“ Best for scheduled batch ETL (hourly, daily)
βœ— Latency: as long as your schedule (5min, 1hr, daily)
SNOWPIPE (auto-ingest)
βœ“ Event-driven: loads within ~1 min of file arrival
βœ“ Serverless (no warehouse needed)
βœ“ Best for near-real-time ingestion from landing zones
βœ“ Tracks recent loaded files in per-table metadata with retention bounds
βœ— Higher cost than COPY INTO for same volume
βœ— Minimum latency ~30 seconds
SNOWPIPE STREAMING (API-based)
βœ“ Push rows directly via SDK (Python/Java)
βœ“ Queryable latency in seconds; measure the current architecture and region
βœ“ Best for: Kafka Connectβ†’Snowflake, real-time IoT, Flink
βœ— Most expensive (pays per row + rows buffered)
βœ— Small files accumulateβ†’needs OPTIMIZE equivalent

SECTION 2: STREAMS & TASKS (CDC in Snowflake)

Answer First: A stream stores an offset over a source object's version history and exposes inserted and deleted row changes plus metadata; its offset advances only when a committed DML transaction consumes it.

Memory Map: What Are Snowflake Streams? How Do They Enable CDC? -> table version offset -> insert/delete rows -> metadata action flag -> transactional consume -> staleness watch [SF_02_Pipelines_Performance.md:142].

Q3: What Are Snowflake Streams? How Do They Enable CDC?

Simple Explanation: A Stream is Snowflake's native CDC (Change Data Capture) mechanism. It tracks every INSERT, UPDATE, and DELETE on a table β€” without modifying the original table or storing a separate copy. When you query the stream, you see "what changed since I last consumed it?" Once you consume the changes inside a DML transaction, the stream automatically advances its offset β€” the consumed rows disappear from the stream view.

Real-world analogy: Think of a hotel check-in/check-out log. The front desk doesn't copy the entire guest database every hour β€” it just records new arrivals (INSERT), room changes (UPDATE), and departures (DELETE). The housekeeping team reads the log, services the rooms, and tears off the page. Tomorrow there's a fresh page with only new changes.

Why do we need it? Without streams, you'd have to either (a) reload the entire table every time (expensive, slow), or (b) build custom CDC logic using timestamps or audit columns (fragile, error-prone). Streams give you a zero-maintenance, guaranteed-consistent way to see exactly what changed β€” perfect for incremental ETL pipelines.

How Streams Track Changes (The Offset Model):

πŸ“ Architecture Diagram
TABLE: raw_bookings
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Row 1  β”‚  Row 2  β”‚  Row 3  β”‚  Row 4      β”‚
β”‚ (old)   β”‚ (old)   β”‚ (new!)  β”‚ (new!)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β–²
                       β”‚ Stream offset points here
                       β”‚ "I've seen everything before Row 3"
                       β”‚
STREAM VIEW: shows Row 3 and Row 4 only (the delta)

After you consume Row 3 & 4 in a DML (INSERT/MERGE):
  β†’ Offset advances to Row 4
  β†’ Stream view is now empty (until new changes arrive)

Streams use Snowflake's internal versioning (Time Travel metadata) to track the offset. No data is copied β€” the stream is essentially a pointer into the table's change history.

Stream Metadata Columns:

Every stream row includes three hidden metadata columns:

ColumnTypeMeaning
METADATA$ACTIONVARCHAR'INSERT' or 'DELETE'
METADATA$ISUPDATEBOOLEANTRUE if this row is part of an UPDATE
METADATA$ROW_IDVARCHARUnique internal row identifier

An UPDATE appears as TWO rows in the stream: a DELETE of the old value + an INSERT of the new value, both with METADATA$ISUPDATE = TRUE.

Stream Types:

TypeTracksUse Case
Standard (default)INSERT + UPDATE + DELETEFull CDC β€” SCD Type 2, MERGE pipelines
Append-onlyINSERT onlyLog/event tables where rows are never updated
Insert-onlyINSERT only (external tables)Tracking new files arriving in external stages
sql
-- ========================================
-- CREATING STREAMS
-- ========================================

-- Standard stream (tracks all DML changes)
CREATE STREAM booking_changes_stream
    ON TABLE raw_bookings
    SHOW_INITIAL_ROWS = FALSE;   -- Only track NEW changes from this point
    -- SHOW_INITIAL_ROWS = TRUE β†’ backfill: include all existing rows as INSERTs

-- Append-only stream (lighter weight β€” only new inserts)
CREATE STREAM new_bookings_stream
    ON TABLE raw_bookings
    APPEND_ONLY = TRUE;
-- Use for event/log tables where rows are never updated or deleted

-- Insert-only stream on an external table
CREATE STREAM new_files_stream
    ON EXTERNAL TABLE ext_booking_files
    INSERT_ONLY = TRUE;
-- Fires when new files appear in the external stage

-- ========================================
-- QUERYING A STREAM (peek at changes)
-- ========================================

SELECT *,
    METADATA$ACTION,         -- 'INSERT' or 'DELETE'
    METADATA$ISUPDATE,       -- TRUE if part of an UPDATE
    METADATA$ROW_ID          -- Internal row identifier
FROM booking_changes_stream;
-- This is a READ β€” it does NOT consume the stream
-- Stream is only consumed when changes are used in a DML statement

-- ========================================
-- CONSUMING A STREAM (the MERGE pattern β€” #1 interview pattern!)
-- ========================================

-- The Stream + MERGE pattern: upsert changes into a target table
MERGE INTO silver_bookings AS target
USING (
    SELECT booking_id, booking_date, amount, airline_code,
           METADATA$ACTION AS action,
           METADATA$ISUPDATE AS is_update
    FROM booking_changes_stream
) AS src
ON target.booking_id = src.booking_id
-- Handle inserts (new rows)
WHEN NOT MATCHED AND src.action = 'INSERT'
    THEN INSERT (booking_id, booking_date, amount, airline_code)
         VALUES (src.booking_id, src.booking_date, src.amount, src.airline_code)
-- Handle updates (new value of updated rows)
WHEN MATCHED AND src.action = 'INSERT' AND src.is_update = TRUE
    THEN UPDATE SET
        target.amount = src.amount,
        target.booking_date = src.booking_date,
        target.airline_code = src.airline_code
-- Handle deletes
WHEN MATCHED AND src.action = 'DELETE' AND src.is_update = FALSE
    THEN DELETE;

-- After MERGE commits β†’ stream advances β†’ consumed rows disappear
-- Next query to stream shows only changes AFTER this MERGE

-- ========================================
-- STALE STREAMS β€” how to avoid them
-- ========================================

-- A stream becomes STALE if you don't consume it within the table's
-- DATA_RETENTION_TIME_IN_DAYS (Time Travel period, default 1 day).
-- Once stale, the stream is BROKEN β€” you must recreate it.

-- Check if a stream is stale:
SHOW STREAMS LIKE 'booking_changes_stream';
-- Look at "stale_after" column β€” if past, the stream is stale

-- Prevention: consume streams regularly OR extend retention:
ALTER TABLE raw_bookings SET DATA_RETENTION_TIME_IN_DAYS = 14;
-- Now stream has 14 days before going stale
-- Trade-off: longer retention = more storage cost (Time Travel storage)

Interview Tip: The Stream + MERGE pattern is the single most asked Snowflake pipeline question. Know it cold. Also explain that streams are "transactional consumers" β€” they only advance when the consuming DML commits. If the MERGE fails, the stream stays where it was (no data loss). Mention stale streams and retention as a follow-up β€” it shows production experience.

Answer First: A Task is Snowflake's built-in scheduler β€” it runs a SQL statement or stored procedure on a defined schedule (cron or interval). Tasks can be chained into a DAG (Directed Acyclic Graph) where child tasks run only after their parent succeeds. Combined with Streams, Tasks form the classic Snowflake incremental pipeline.

Memory Map: What Are Snowflake Tasks? How Do You Schedule SQL? -> schedule trigger -> warehouse or serverless run -> graph dependencies -> resume children then root -> history alert [SF_02_Pipelines_Performance.md:280].

Q4: What Are Snowflake Tasks? How Do You Schedule SQL?

Simple Explanation: A Task is Snowflake's built-in scheduler β€” it runs a SQL statement or stored procedure on a defined schedule (cron or interval). Tasks can be chained into a DAG (Directed Acyclic Graph) where child tasks run only after their parent succeeds. Combined with Streams, Tasks form the classic Snowflake incremental pipeline.

Real-world analogy: Think of a factory assembly line with a foreman. The foreman (Task scheduler) blows a whistle every 5 minutes. Station 1 (bronze) starts work. When Station 1 finishes, Station 2 (silver) automatically begins. Station 3 (gold) waits for Station 2. If the foreman sees no raw materials on the conveyor belt (SYSTEM$STREAM_HAS_DATA() = FALSE), he skips that cycle β€” no wasted work.

Why do we need it? Without Tasks, you'd need an external scheduler (Airflow, cron, Azure Data Factory) just to run SQL on a timer. Tasks keep everything inside Snowflake β€” no external dependencies, no credentials to manage, no network calls. For simple-to-medium pipelines, Tasks eliminate an entire orchestration layer.

sql
-- ========================================
-- CREATING TASKS
-- ========================================

-- Simple task: run SQL every 5 minutes using a warehouse
CREATE TASK load_bronze_task
    WAREHOUSE = 'ETL_WH'               -- Uses this warehouse's credits
    SCHEDULE = '5 MINUTE'              -- Interval schedule
AS
    COPY INTO raw_bookings
    FROM @azure_booking_stage;

-- Cron-based schedule
CREATE TASK nightly_aggregate_task
    WAREHOUSE = 'ETL_WH'
    SCHEDULE = 'USING CRON 0 2 * * * UTC'   -- 2:00 AM UTC daily
    -- Cron: minute hour day month weekday timezone
AS
    CALL refresh_daily_aggregates();

-- !! CRITICAL: Tasks are SUSPENDED by default !!
-- You MUST resume them or they will never run
ALTER TASK load_bronze_task RESUME;
ALTER TASK load_bronze_task SUSPEND;     -- Pause it

-- ========================================
-- SERVERLESS TASKS vs WAREHOUSE-BASED TASKS
-- ========================================

-- Warehouse-based: uses a specific warehouse (you control size & cost)
CREATE TASK warehouse_task
    WAREHOUSE = 'ETL_WH'
    SCHEDULE = '10 MINUTE'
AS SELECT 1;

-- Serverless: Snowflake manages compute β€” no warehouse needed
CREATE TASK serverless_task
    USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'MEDIUM'
    -- Omit WAREHOUSE = ... to make it serverless
    SCHEDULE = '5 MINUTE'
AS
    INSERT INTO audit_log VALUES (CURRENT_TIMESTAMP, 'heartbeat');

-- Serverless tasks:
-- βœ“ metered separately; compare actual workload cost than warehouse-based for equivalent work
-- βœ“ No warehouse to manage β€” auto-scales to workload
-- βœ“ Best for lightweight, frequent tasks
-- βœ— Less control over compute resources
-- βœ— Compute size is approximate (Snowflake decides)

-- ========================================
-- TASK TREES (DAG β€” parent β†’ child dependencies)
-- ========================================

-- Root task: has a SCHEDULE (the only task that needs one)
CREATE TASK bronze_task
    WAREHOUSE = 'ETL_WH'
    SCHEDULE = 'USING CRON 0 2 * * * UTC'  -- 2 AM daily
AS
    CALL load_bronze_data();

-- Child task: uses AFTER clause (no SCHEDULE β€” triggered by parent)
CREATE TASK silver_task
    WAREHOUSE = 'ETL_WH'
    AFTER bronze_task               -- Runs ONLY after bronze_task succeeds
AS
    CALL transform_silver_data();

-- Grandchild task: runs after silver
CREATE TASK gold_task
    WAREHOUSE = 'ETL_WH'
    AFTER silver_task
AS
    CALL aggregate_gold_metrics();

-- A child can depend on MULTIPLE parents (fan-in):
CREATE TASK final_report_task
    WAREHOUSE = 'ETL_WH'
    AFTER silver_task, gold_task     -- Waits for BOTH to finish
AS
    CALL generate_report();

-- Initial activation option 1: resume every desired child first, root last
ALTER TASK gold_task RESUME;
ALTER TASK silver_task RESUME;
ALTER TASK bronze_task RESUME;      -- Root task last

-- Initial activation option 2: recursively resume root + all dependents
SELECT SYSTEM$TASK_DEPENDENTS_ENABLE('bronze_task');

-- ========================================
-- CONDITIONAL EXECUTION: SYSTEM$STREAM_HAS_DATA()
-- ========================================

-- Only run the task if the stream has new data (skip empty cycles)
CREATE TASK process_booking_changes
    WAREHOUSE = 'ETL_WH'
    SCHEDULE = '5 MINUTE'
    WHEN SYSTEM$STREAM_HAS_DATA('booking_changes_stream')
    -- If stream is empty β†’ task is SKIPPED (no warehouse credit used!)
AS
    MERGE INTO silver_bookings AS target
    USING booking_changes_stream AS src
    ON target.booking_id = src.booking_id
    WHEN NOT MATCHED AND src.METADATA$ACTION = 'INSERT'
        THEN INSERT (booking_id, booking_date, amount, airline_code)
             VALUES (src.booking_id, src.booking_date, src.amount, src.airline_code)
    WHEN MATCHED AND src.METADATA$ACTION = 'INSERT' AND src.METADATA$ISUPDATE = TRUE
        THEN UPDATE SET target.amount = src.amount
    WHEN MATCHED AND src.METADATA$ACTION = 'DELETE' AND src.METADATA$ISUPDATE = FALSE
        THEN DELETE;

ALTER TASK process_booking_changes RESUME;

-- ========================================
-- COMPLETE STREAM + TASK PIPELINE (end-to-end example)
-- ========================================

-- Step 1: Source table exists
-- CREATE TABLE raw_bookings (booking_id VARCHAR, booking_date DATE, ...);

-- Step 2: Create stream to track changes
CREATE STREAM booking_cdc_stream ON TABLE raw_bookings;

-- Step 3: Create task that consumes stream via MERGE
CREATE TASK cdc_pipeline_task
    WAREHOUSE = 'ETL_WH'
    SCHEDULE = '5 MINUTE'
    WHEN SYSTEM$STREAM_HAS_DATA('booking_cdc_stream')
AS
    MERGE INTO silver_bookings AS t
    USING booking_cdc_stream AS s
    ON t.booking_id = s.booking_id
    WHEN MATCHED AND s.METADATA$ACTION = 'DELETE' AND s.METADATA$ISUPDATE = FALSE
        THEN DELETE
    WHEN MATCHED AND s.METADATA$ACTION = 'INSERT' AND s.METADATA$ISUPDATE = TRUE
        THEN UPDATE SET t.amount = s.amount, t.booking_date = s.booking_date
    WHEN NOT MATCHED AND s.METADATA$ACTION = 'INSERT'
        THEN INSERT (booking_id, booking_date, amount)
             VALUES (s.booking_id, s.booking_date, s.amount);

-- Step 4: Resume the task
ALTER TASK cdc_pipeline_task RESUME;

-- Now: any INSERT/UPDATE/DELETE on raw_bookings is automatically
-- captured by the stream and merged into silver_bookings every 5 minutes

-- ========================================
-- MONITORING TASKS
-- ========================================

-- View task run history (recent runs, status, errors)
SELECT name, state, scheduled_time, completed_time,
       error_code, error_message,
       DATEDIFF('second', query_start_time, completed_time) AS duration_sec
FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY(
    TASK_NAME => 'CDC_PIPELINE_TASK',
    SCHEDULED_TIME_RANGE_START => DATEADD('day', -1, CURRENT_TIMESTAMP)
))
ORDER BY scheduled_time DESC;
-- state: 'SUCCEEDED', 'FAILED', 'SKIPPED' (WHEN condition was false)

-- Account-level task history (all tasks)
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.TASK_HISTORY
WHERE scheduled_time > DATEADD('hour', -24, CURRENT_TIMESTAMP)
ORDER BY scheduled_time DESC;

Interview Tip: Always mention three things: (1) newly created tasks are suspended; initially resume desired children before the root, or call SYSTEM$TASK_DEPENDENTS_ENABLE to recursively resume the graph; (2) only the root needs a schedule; and (3) WHEN SYSTEM$STREAM_HAS_DATA() avoids empty work. After a previously enabled graph's root is suspended, its children retain their state, so resuming that root does not require re-resuming children. See task graph activation and SYSTEM$TASK_DEPENDENTS_ENABLE.

Answer First: A dynamic table materializes a declarative query and lets Snowflake schedule supported full or incremental refreshes toward a target lag; it removes explicit offsets and task DAGs but does not guarantee freshness.

Memory Map: What Are Dynamic Tables? How Are They Different from Streams + Tasks? -> target lag planner -> declarative SELECT -> incremental or full refresh -> downstream orchestration -> refresh history [SF_02_Pipelines_Performance.md:461].

Q5: What Are Dynamic Tables? How Are They Different from Streams + Tasks?

Simple Explanation: Dynamic Tables (GA 2024, recommended approach 2025-2026) are Snowflake's declarative ELT mechanism. You define WHAT the result should look like using a SELECT query, and Snowflake handles the WHEN (scheduling) and HOW (incremental refresh). You never write MERGE logic, manage stream offsets, or build Task DAGs β€” Snowflake does it all automatically.

Real-world analogy:

  • Streams + Tasks = writing a recipe step by step, setting timers, and telling someone exactly how to cook each ingredient
  • Dynamic Tables = showing someone a photo of the finished dish and saying "keep it looking like this, and make sure it's no more than 5 minutes stale"

Why do we need them? Streams + Tasks pipelines work but require 30+ lines of boilerplate per stage (create stream, create task, write MERGE, handle edge cases, resume tasks). For a 5-stage pipeline, that's 150+ lines of procedural code to maintain. Dynamic Tables reduce each stage to a single CREATE statement. Snowflake auto-detects dependencies, auto-schedules refreshes, and auto-computes incremental diffs.

The TARGET_LAG parameter (best-effort staleness target):

🧠 Memory Map
TARGET_LAG = '5 minutes'
β†’ Snowflake schedules refreshes with a goal of staying within 5 minutes
β†’ Actual lag can exceed the target under compute, volume, or pipeline pressure
β†’ It is a best-effort target; actual lag can exceed five minutes
TARGET_LAG = '1 hour'
β†’ Cheaper (fewer refreshes), but data can be up to 1 hour behind
TARGET_LAG = 'DOWNSTREAM'
β†’ Has no independent refresh schedule
β†’ Refreshes when a downstream dynamic table refresh requires it
sql
-- ========================================
-- CREATING DYNAMIC TABLES
-- ========================================

-- Silver layer: clean + transform raw data
CREATE DYNAMIC TABLE silver_bookings
    TARGET_LAG = '5 minutes'         -- Best-effort maximum staleness target
    WAREHOUSE = 'ETL_WH'             -- Warehouse for refresh compute
AS
SELECT
    booking_id,
    booking_date,
    UPPER(airline_code)     AS airline_code,
    amount,
    CURRENT_TIMESTAMP       AS processed_at
FROM raw_bookings
WHERE amount > 0
  AND booking_id IS NOT NULL;

-- Snowflake AUTOMATICALLY:
-- 1. Detects when raw_bookings changes
-- 2. Computes ONLY the incremental diff (not full reprocess)
-- 3. Attempts to keep silver_bookings within the target; monitor actual lag

-- Gold layer: aggregate (auto-chains to silver!)
CREATE DYNAMIC TABLE gold_daily_revenue
    TARGET_LAG = '1 hour'
    WAREHOUSE = 'ETL_WH'
AS
SELECT
    booking_date,
    airline_code,
    SUM(amount)  AS daily_revenue,
    COUNT(*)     AS booking_count
FROM silver_bookings    -- Reads from dynamic table above!
GROUP BY booking_date, airline_code;
-- Snowflake auto-detects the silver β†’ gold dependency
-- No AFTER clause needed β€” it just works

-- Manually refresh (force update now, useful for testing)
ALTER DYNAMIC TABLE silver_bookings REFRESH;

-- Suspend / resume
ALTER DYNAMIC TABLE silver_bookings SUSPEND;
ALTER DYNAMIC TABLE silver_bookings RESUME;

-- Check status of all dynamic tables
SELECT name, schema_name, target_lag, refresh_mode,
       refresh_mode_reason, data_timestamp
FROM INFORMATION_SCHEMA.DYNAMIC_TABLES;
-- refresh_mode: 'INCREMENTAL' (optimal) or 'FULL' (fallback if query is too complex)
-- data_timestamp: when the data was last refreshed to

Comparison: Dynamic Tables vs Streams + Tasks vs Materialized Views:

Dynamic TablesStreams + TasksMaterialized Views
StyleDeclarative (WHAT)Procedural (HOW)Declarative (WHAT)
Setup complexitySingle CREATE30+ lines (stream + task + MERGE)Single CREATE
Joins supportedFull SQLFull SQLNo joins (single table only)
AggregationsYesYesYes
Incremental refreshAutomaticManual (you write MERGE)Automatic
Dependency mgmtAuto-detectedManual (AFTER clause)N/A (no chaining)
Freshness controlBest-effort target, minimum 1 minuteSchedule/triggerService-managed refresh
SCD Type 2Not supportedSupported (stream tracks before/after)Not supported
Complex logicSQL onlySQL + stored procedures + external functionsSimple aggregations only
Best forMulti-step ELT pipelinesComplex CDC, SCD Type 2, sub-minute latencyBI dashboard acceleration

When to use which:

  • Dynamic Tables β€” Default choice for new ELT pipelines. Multi-stage bronze β†’ silver β†’ gold transformations.
  • Streams + Tasks β€” When you need SCD Type 2, sub-minute latency, stored procedures, or external function calls.
  • Materialized Views β€” Single-table aggregations for BI dashboards (no joins, no UDFs, read-heavy/write-light tables).

Interview Tip: Lead with Dynamic Tables for supported declarative transformations, then contrast Streams + Tasks when explicit CDC handling or procedural orchestration is required. TARGET_LAG is a best-effort staleness target, not a schedule or SLA; actual lag can exceed it, so monitor refresh history and size refresh compute from evidence. See current target-lag semantics.

Answer First: A materialized view physically stores an eligible single-table query result and Snowflake maintains it as base micro-partitions change; repeated reads can improve while background maintenance and storage add cost.

Memory Map: Q5b: Explain Materialized Views in Snowflake -> precomputed subset -> automatic maintenance -> query rewrite opportunity -> storage credits -> profile validation [SF_02_Pipelines_Performance.md:568].

Q5b: Explain Materialized Views in Snowflake

Simple Explanation: A Materialized View (MV) is a pre-computed, physically stored result of a query. Unlike a regular view (which re-runs the query every time you SELECT from it), a Materialized View stores the results on disk and Snowflake automatically keeps them in sync with the base table. Queries that hit the MV read pre-computed results instead of scanning the full table β€” often 10-100x faster.

Real-world analogy: A regular view is like asking the librarian "how many books do we have by genre?" every time β€” she counts them all each time you ask. A Materialized View is like a summary card pinned to the wall that says "Fiction: 500, Science: 200, History: 150." The librarian updates the card whenever new books arrive. You just read the card β€” instant answer.

Why do we need it? BI dashboards often run the same expensive aggregation queries hundreds of times per day. Without MVs, each dashboard refresh scans the full fact table. With MVs, the aggregation is pre-computed and auto-refreshed β€” the dashboard reads the small, pre-aggregated result instead.

How auto-refresh works: Snowflake automatically detects when the base table changes and refreshes the MV in the background. You do not schedule refreshes β€” they happen transparently. The refresh is incremental (only processes changed micro-partitions), so it's efficient.

sql
-- ========================================
-- CREATING A MATERIALIZED VIEW
-- ========================================

CREATE MATERIALIZED VIEW daily_revenue_mv AS
SELECT
    booking_date,
    airline_code,
    SUM(amount)   AS total_revenue,
    COUNT(*)      AS booking_count,
    AVG(amount)   AS avg_booking_value
FROM fact_bookings
GROUP BY booking_date, airline_code;
-- Snowflake physically stores this result
-- Auto-refreshes when fact_bookings changes

-- Query the MV (same as querying a table β€” but pre-computed!)
SELECT * FROM daily_revenue_mv
WHERE booking_date = '2026-03-25' AND airline_code = 'LH';
-- Returns instantly β€” reads pre-aggregated result, not the full fact table

-- Snowflake's optimizer can AUTOMATICALLY route queries to the MV
-- Even if you query the BASE TABLE, Snowflake may use the MV if it
-- detects the query matches the MV's definition (query rewrite)

-- Drop a materialized view
DROP MATERIALIZED VIEW daily_revenue_mv;

-- Check MV refresh status
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.MATERIALIZED_VIEW_REFRESH_HISTORY
WHERE materialized_view_name = 'DAILY_REVENUE_MV'
ORDER BY start_time DESC;

Limitations (important for interviews!):

LimitationDetail
No joinsMV can only reference a SINGLE base table
No UDFsCannot use user-defined functions
No subqueriesCannot use subqueries in the MV definition
No window functionsROW_NUMBER(), RANK(), etc. not allowed
No UNIONCannot combine multiple queries
Single table onlyCannot join fact + dimension tables in MV
Write-light tables onlyFrequent writes = frequent (expensive) refreshes

Cost implications:

  • Storage cost: The MV physically stores data (additional storage credits).
  • Compute cost: Auto-refresh consumes serverless compute credits (background maintenance). Snowflake charges for this automatically β€” you don't control when it runs.
  • Rule of thumb: MVs save money when reads >> writes. If the base table changes every minute and the MV is queried once per day, the refresh cost exceeds the query savings β€” don't use an MV.

When to use Materialized Views:

USE MVs when:
βœ“ Single-table aggregations (SUM, COUNT, AVG by common dimensions)
βœ“ Read-heavy, write-light tables (fact table updated daily, queried 1000x/day)
βœ“ BI dashboard acceleration (same aggregation run by many analysts)
βœ“ You want Snowflake to auto-route queries to pre-computed results
DON'T use MVs when:
βœ— You need joins (use Dynamic Tables instead)
βœ— Table changes frequently (high refresh cost)
βœ— Complex logic (UDFs, window functions, subqueries)
βœ— Multi-step transformations (use Dynamic Tables or Streams+Tasks)

Interview Tip: The #1 interview follow-up is "MV vs Dynamic Table β€” when would you use each?" Answer: MVs for simple single-table aggregations on read-heavy tables (BI acceleration). Dynamic Tables for anything involving joins, multi-step transformations, or complex SQL. Also mention that MVs support automatic query rewrite β€” even if analysts query the base table, Snowflake can transparently use the MV if the query pattern matches. This is a feature Dynamic Tables do NOT have.

SECTION 3: SNOWPARK

Answer First: Snowpark is Snowflake's API for Python (also Java/Scala) that lets you write DataFrame-style code that runs INSIDE Snowflake's compute β€” like PySpark, but for Snowflake. Instead of extracting data to a Python environment and processing it there, Snowpark pushes the computation to Snowflake.

Memory Map: What is Snowpark? When is it useful? -> DataFrame code builds a lazy plan -> Snowflake compute executes near governed data -> UDF packaging and profile evidence bound suitability [SF_02_Pipelines_Performance.md:655].

Q6: What is Snowpark? When is it useful?

Simple Explanation: Snowpark is Snowflake's API for Python (also Java/Scala) that lets you write DataFrame-style code that runs INSIDE Snowflake's compute β€” like PySpark, but for Snowflake. Instead of extracting data to a Python environment and processing it there, Snowpark pushes the computation to Snowflake.

Real-world analogy: Normally, if you want to analyze data in Snowflake with Python, you'd pull it to your laptop (expensive network transfer), process it, then push back (another transfer). Snowpark = run Python code on Snowflake's servers directly. No data leaves Snowflake.

python β€” editable
# Connect to Snowflake with Snowpark
from snowflake.snowpark import Session
from snowflake.snowpark.functions import col, sum, upper, current_timestamp

session = Session.builder.configs({
    "account":   "travelco-prod",
    "user":      "data_engineer",
    "password":  "***",
    "warehouse": "ETL_WH",
    "database":  "ANALYTICS_DB",
    "schema":    "BOOKINGS"
}).create()

# Create a Snowpark DataFrame (lazy β€” nothing runs yet)
raw_df = session.table("RAW_BOOKINGS")    # Points to Snowflake table

# Transform using DataFrame API (exactly like PySpark!)
silver_df = (raw_df
    .filter(col("AMOUNT") > 0)           # Filter bad rows
    .filter(col("BOOKING_ID").isNotNull())
    .select(
        col("BOOKING_ID"),
        col("BOOKING_DATE"),
        upper(col("AIRLINE_CODE")).alias("AIRLINE_CODE"),  # Transform
        col("AMOUNT"),
        current_timestamp().alias("PROCESSED_AT")
    )
)

# Write to Snowflake table (this EXECUTES the computation β€” runs in Snowflake!)
silver_df.write.mode("append").save_as_table("SILVER_BOOKINGS")
# All processing happened INSIDE Snowflake β€” no data left Snowflake!

# Snowpark UDF: Write Python function, run in Snowflake
from snowflake.snowpark.functions import udf
import snowflake.snowpark.types as T

@udf(return_type=T.FloatType(), input_types=[T.FloatType(), T.StringType()])
def calculate_tax(amount: float, country: str) -> float:
    """Run Python code INSIDE Snowflake β€” no data transfer"""
    tax_rates = {"IN": 0.18, "UK": 0.20, "DE": 0.19}
    return amount * tax_rates.get(country, 0.0)

# Use the UDF in SQL or DataFrame
result = silver_df.select(
    col("AMOUNT"),
    calculate_tax(col("AMOUNT"), col("COUNTRY")).alias("TAX")
)

New 2026: Snowpark Intelligent Hybrid Execution

python β€” editable
# Snowpark now AUTOMATICALLY decides:
# - Run small operations locally on your machine (faster for tiny data)
# - Push large operations to Snowflake (for big data)
# No code change needed β€” it detects which is optimal automatically

import modin.pandas as mpd   # Drop-in pandas replacement
df = mpd.read_snowflake("SELECT * FROM bookings WHERE date > '2026-01-01'")
# Snowpark decides: big table β†’ run in Snowflake; result small β†’ return locally

SECTION 4: PERFORMANCE TUNING

Answer First: Optimize from Query Profile evidence: reduce bytes scanned and spill first, verify pruning and physical design, then right-size or scale concurrency only for the remaining bottleneck.

Memory Map: How do you optimize query performance in Snowflake? -> profile bottleneck -> partition pruning -> join spill -> SQL rewrite -> measured rerun [SF_02_Pipelines_Performance.md:729].

Q7: How do you optimize query performance in Snowflake?

The PERFORMANCE CHECKLIST ("CQMWS"):

CClustering (is data well clustered for this query's filters?)
QQuery Profile (find the bottleneck β€” where is time spent?)
MMaterialized Views (pre-compute expensive aggregations)
WWarehouse size (is the warehouse right-sized for this workload?)
SSearch Optimization Service (for point-lookup queries on unordered data)
Remember: "CQMWS" = Clustering, Query profile, Materialized views, Warehouse, Search
sql
-- STEP 1: Find slow queries
SELECT query_text, total_elapsed_time/1000 as seconds,
       bytes_scanned/1024/1024/1024 as gb_scanned,
       partitions_scanned, partitions_total,
       ROUND(partitions_scanned*100.0/partitions_total, 1) as pct_scanned
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE execution_status = 'SUCCESS'
  AND warehouse_name = 'BI_WH'
ORDER BY total_elapsed_time DESC
LIMIT 20;
-- HIGH pct_scanned (>80%) = bad pruning β†’ add clustering key
-- LOW gb_scanned but slow = compute bottleneck β†’ scale up warehouse

-- STEP 2: Check clustering health
SELECT SYSTEM$CLUSTERING_INFORMATION('bookings', '(booking_date, airline_code)');
-- average_depth > 6 β†’ reclustering needed
-- average_overlaps > 5 β†’ partitions heavily mixed

-- STEP 3: Use Materialized Views for repeated heavy aggregations
CREATE MATERIALIZED VIEW daily_revenue_mv AS
SELECT booking_date, airline_code, SUM(amount) as revenue
FROM silver_bookings
GROUP BY booking_date, airline_code;
-- Snowflake pre-computes and auto-refreshes this view
-- BI queries that aggregate by date+airline now hit MV instead of raw table
-- 100x faster for common aggregation queries!

-- STEP 4: Search Optimization Service (for needle-in-haystack queries)
ALTER TABLE bookings ADD SEARCH OPTIMIZATION;
-- Optimizes: WHERE booking_id = 'BK123456' (point lookup)
-- Optimizes: WHERE passenger_email = 'user@example.com' (equality on high-cardinality col)
-- NOT for range queries (use clustering key instead)

-- STEP 5: Query Profile analysis
-- After running a query, in Snowflake UI: Query History β†’ Click query β†’ Query Profile
-- Shows execution tree, where time was spent
-- Key metrics to look for:
--   "Bytes scanned from cache" high = good (cache working)
--   "Partitions scanned" vs "Partitions total" β†’ pruning efficiency
--   "Spilling to disk" = not enough memory β†’ scale up warehouse

Materialized Views vs Dynamic Tables:

Materialized ViewDynamic Table
Define withCREATE MATERIALIZED VIEWCREATE DYNAMIC TABLE
Auto-refreshYes (automatic)Yes (on target lag)
Supports joinsLimitedFull SQL (all joins)
Supports streamsNoYes (incremental from streams)
ComplexitySimple aggregationsComplex ELT
Best forBI aggregations, dashboardsMulti-step ELT pipelines

Answer First: For 200 BI users, separate BI from ETL compute, use queued-overload time to decide whether multi-cluster scale-out is needed, then address individual scan, spill, and aggregation costs from Query Profile.

Memory Map: Scenario β€” Dashboard queries are slow for 200 BI analysts. How to fix? -> queue time diagnoses concurrency pressure -> profiles expose per-query waste -> isolated compute and precomputation reduce contention [SF_02_Pipelines_Performance.md:799].

Q8: Scenario β€” Dashboard queries are slow for 200 BI analysts. How to fix?

🧠 SIZE = 'MEDIUM'
DIAGNOSIS STEPS
1. Check: Are queries queuing or slow individually?
β†’ Check QUERY_HISTORY for queries where queued_overload_time > 0
→ If queuing→concurrency problem → scale OUT (multi-cluster)
→ If not queuing but slow→computation problem → scale UP or clustering
2. Separate persisted-result reuse from warehouse data cache:
β†’ Persisted-result reuse bypasses execution when eligibility conditions hold
β†’ For executed queries, QUERY_HISTORY.percentage_scanned_from_cache measures local warehouse cache reads
β†’ Inspect Query History/Profile; there is no dedicated persisted-result boolean
3. Check: Partition pruning ratio
→ High partitions_scanned/total→add clustering key on filter columns
SOLUTION BLUEPRINT
-- Separate BI warehouse from ETL
CREATE WAREHOUSE bi_wh
SIZE'MEDIUM'
MIN_CLUSTER_COUNT = 2 -- Always at least 2 clusters for BI hours
MAX_CLUSTER_COUNT = 8 -- Scale to 8 during peak
AUTO_SUSPEND = 600 -- 10 min idle before suspend (keep cache warm!)
SCALING_POLICY = 'STANDARD';
-- Pre-aggregate with Materialized Views
CREATE MATERIALIZED VIEW booking_summary_mv AS
SELECT DATE_TRUNC('month', booking_date) AS month,
airline_code, SUM(amount) AS revenue, COUNT(*) AS bookings
FROM fact_bookings
GROUP BY 1, 2;
-- BI dashboards now hit MV = instant
-- Cluster fact tables by common filter columns
ALTER TABLE fact_bookings CLUSTER BY (booking_date, airline_code);
-- Route BI dashboards to BI warehouse (not ETL warehouse)
-- Tool: Power BI / Tableau connection string→bi_wh warehouse

Day 2: Pipelines & Performance β€” Quick Recall Guide

⚑Must rememberπŸ”‘Key concept⚠️Common trap🧠Memory MapπŸ“One-liner

🧠 MASTER MEMORY MAP β€” Day 2

🧠 DATA LOADING = "CSP" (Cheapβ†’Smartβ†’Push)
DATA LOADING"CSP" (Cheap β†’ Smart β†’ Push)
CCOPY INTO (batch, cheapest, manual trigger)
SSnowpipe (auto-ingest, ~1 min latency, event-driven)
PSnowpipe Streaming (row streaming via SDK or REST API; queryable in seconds)
CDC INSIDE SNOWFLAKE"Streams + Tasks" OR "Dynamic Tables"
Streams = track what CHANGED in a table (INSERT/UPDATE/DELETE)
Tasks = scheduled SQL (run stream processor every N min)
Dynamic Tables = declarative managed refresh; Streams and Tasks remain appropriate when explicit change handling or procedural orchestration is required
STREAMS"A camera watching your table"
3 metadata columns:
METADATA$ACTION = 'INSERT' or 'DELETE'
METADATA$ISUPDATE = TRUE if row is part of an UPDATE
METADATA$ROW_ID = unique row identifier
⚠️UPDATE = DELETE old + INSERT new (two rows in stream!)
TASKS"Cron jobs inside Snowflake"
Root task: has SCHEDULE
Child tasks: have AFTER parent_task
New graph: resume desired children first, then the root
Alternative: recursively enable root and dependents with the system function
Serverless tasks need no named warehouse; compare metered serverless cost with a representative user-managed run
DYNAMIC TABLES"Declarative ELT β€” you say WHAT, Snowflake does HOW"
CREATE DYNAMIC TABLE ... TARGET_LAG = '5 minutes' AS SELECT ...
Min lag = 1 minute
AUTO is the default refresh mode and resolves at creation to FULL or INCREMENTAL; set the mode explicitly for predictable production behavior
⚠️Validate the current supported-query and refresh-mode rules before choosing Dynamic Tables for an SCD design
PERFORMANCE"CQMWS"
CClustering key (organize micro-partitions by filter columns)
QQuery Profile (find bottleneck: pruning? memory? compute?)
MMaterialized Views (pre-compute heavy aggregations)
WWarehouse sizing (scale UP for slow, scale OUT for concurrency)
SSearch Optimization (point lookups: WHERE id = 'X')

SECTION 1: DATA LOADING

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: Snowflake's bulk loading command β€” reads files from a stage and loads into a table in parallel. Much faster than INSERT for large volumes. Uses load metadata to avoid recent duplicate file loads; metadata retention bounds still apply.

Memory Map: What is COPY INTO? -> staged file set -> parallel warehouse readers -> table load metadata -> ON_ERROR contract -> FORCE risk [SF_02_Quick_Recall.md:53].

What is COPY INTO?

Snowflake's bulk loading command β€” reads files from a stage and loads into a table in parallel. Much faster than INSERT for large volumes. Uses load metadata to avoid recent duplicate file loads; metadata retention bounds still apply.

Answer First: A pointer to a file location (loading dock). Internal stage = Snowflake's storage. External stage = your ADLS/S3/GCS. Files land in stage, COPY INTO loads them into tables.

Memory Map: What is a Stage? -> internal or external file pointer -> credentials and format -> COPY consumes path -> PURGE or retention choice -> access test [SF_02_Quick_Recall.md:56].

What is a Stage?

A pointer to a file location (loading dock). Internal stage = Snowflake's storage. External stage = your ADLS/S3/GCS. Files land in stage, COPY INTO loads them into tables.

Answer First: Auto-ingest loading β€” monitors a stage and automatically runs COPY INTO when new files arrive. Uses event notifications (Azure Event Grid / AWS SQS). Latency: ~30 seconds to 1 minute.

Memory Map: What is Snowpipe? -> cloud notification -> pipe backlog -> serverless copier -> copy history proof -> batch alternative [SF_02_Quick_Recall.md:59].

What is Snowpipe?

Auto-ingest loading β€” monitors a stage and automatically runs COPY INTO when new files arrive. Uses event notifications (Azure Event Grid / AWS SQS). Latency: ~30 seconds to 1 minute.

Answer First: Row-level push API (Python/Java SDK) for very low latency ingestion. Data pushed directly to Snowflake rows. Used with Kafka Connect, Flink. Current high-performance Snowpipe Streaming guidance describes queryable latency in seconds, as low as 5 seconds; benchmark the target region and workload.

Memory Map: What is Snowpipe Streaming? -> SDK channel rows -> no staged files -> seconds queryability -> buffering cost -> client error handling [SF_02_Quick_Recall.md:62].

What is Snowpipe Streaming?

Row-level push API (Python/Java SDK) for very low latency ingestion. Data pushed directly to Snowflake rows. Used with Kafka Connect, Flink. Current high-performance Snowpipe Streaming guidance describes queryable latency in seconds, as low as 5 seconds; benchmark the target region and workload.

Answer First: Use COPY INTO for controlled file batches, Snowpipe for event-driven file ingestion, and Snowpipe Streaming for row ingestion through the current SDK or REST architecture.

Memory Map: COPY INTO vs Snowpipe vs Snowpipe Streaming β€” when to use which? -> scheduled files -> event files -> streaming rows -> freshness cost matrix -> operational owner [SF_02_Quick_Recall.md:65].

COPY INTO vs Snowpipe vs Snowpipe Streaming β€” when to use which?

COPY INTOSnowpipeSnowpipe Streaming
TriggerManual/TaskFile eventAPI push
LatencySchedule intervalEvent-driven file loadSeconds for the current high-performance architecture
CostCheapestMidHighest
Use forBatch ETL (hourly, daily)Near-real-time filesReal-time rows (Kafka)

Answer First: For recent files, Snowflake load metadata normally prevents duplicate loading. The metadata expires after 64 days, and FORCE = TRUE can duplicate rows, so durable replay controls still matter.

Memory Map: Is COPY INTO safe to re-run? -> load metadata lookup -> 64-day boundary -> FORCE duplicates -> durable file id -> replay plan [SF_02_Quick_Recall.md:73].

Is COPY INTO safe to re-run?

Answer First: ON_ERROR chooses the failure boundary: ABORT_STATEMENT stops the load, CONTINUE records rejected rows while loading valid rows, and SKIP_FILE rejects an affected file.

Memory Map: What happens with bad rows in COPY INTO? -> ON_ERROR mode -> rejected row validation -> staged file quarantine -> repair reload -> audit trail [SF_02_Quick_Recall.md:76].

What happens with bad rows in COPY INTO?

Depends on ON_ERROR setting:

  • ABORT_STATEMENT (default) β€” stops everything on first error
  • CONTINUE β€” skips bad rows, continues loading rest
  • SKIP_FILE β€” skips entire file on any error

SECTION 2: STREAMS

🧠 Memory Map: Streams

🧠 STREAM = "Change tracking on a table"
STREAM"Change tracking on a table"
Think: Stream is like a CHANGELOG β€” every INSERT/UPDATE/DELETE
is recorded with metadata. When you consume it, it advances.
STREAM ON TABLE bookings→captures all changes to bookings
Stream TYPES:
Standard: INSERT + UPDATE + DELETE (full CDC)
Append-only: INSERT only (lighter, for append-only tables)
Insert-only: For external tables (only new files)
METADATA COLUMNS (always present)
METADATA$ACTION = 'INSERT' or 'DELETE'
METADATA$ISUPDATE = TRUE if part of UPDATE operation
METADATA$ROW_ID = unique Snowflake row identifier
HOW UPDATE APPEARS IN STREAM
UPDATE row→TWO records in stream:
Row 1: METADATA$ACTION='DELETE', METADATA$ISUPDATE=TRUE ← old value
Row 2: METADATA$ACTION='INSERT', METADATA$ISUPDATE=TRUE ← new value
Filter for new value: WHERE METADATA$ACTION='INSERT' AND METADATA$ISUPDATE=TRUE
Filter for old value: WHERE METADATA$ACTION='DELETE' AND METADATA$ISUPDATE=TRUE
STREAM "ADVANCES" after consumption:
Read stream in a Task→Task commits → stream advances
Stream now shows ONLY newer changes (old consumed ones gone)
⚠️Must consume stream in a DML transaction to advance it

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: A Snowflake object that tracks row-level changes (INSERT/UPDATE/DELETE) on a table. Returns only the changes since last consumption. Used for incremental ELT pipelines.

Memory Map: What is a Stream? -> change view offset -> source version bookmark -> DML consume advances -> stale when unread -> recreate strategy [SF_02_Quick_Recall.md:123].

What is a Stream?

A Snowflake object that tracks row-level changes (INSERT/UPDATE/DELETE) on a table. Returns only the changes since last consumption. Used for incremental ELT pipelines.

Answer First: METADATA$ACTION (INSERT/DELETE), METADATA$ISUPDATE (TRUE if part of UPDATE), METADATA$ROW_ID (unique row identifier).

Memory Map: What are the 3 metadata columns in a Stream? -> ACTION kind -> ISUPDATE pair marker -> ROW_ID identity -> merge routing -> audit debug [SF_02_Quick_Recall.md:126].

What are the 3 metadata columns in a Stream?

METADATA$ACTION (INSERT/DELETE), METADATA$ISUPDATE (TRUE if part of UPDATE), METADATA$ROW_ID (unique row identifier).

Answer First: As TWO rows: one DELETE (the old value, ISUPDATE=TRUE) and one INSERT (the new value, ISUPDATE=TRUE). To get current value: filter METADATA$ACTION='INSERT' AND METADATA$ISUPDATE=TRUE.

Memory Map: How does an UPDATE appear in a Standard Stream? -> delete old row -> insert new row -> ISUPDATE true -> merge collapse -> net change reasoning [SF_02_Quick_Recall.md:129].

How does an UPDATE appear in a Standard Stream?

As TWO rows: one DELETE (the old value, ISUPDATE=TRUE) and one INSERT (the new value, ISUPDATE=TRUE). To get current value: filter METADATA$ACTION='INSERT' AND METADATA$ISUPDATE=TRUE.

Answer First: Tracks only INSERTs, not UPDATEs or DELETEs. Lighter weight (less metadata overhead). Use when your source table is append-only (like Bronze raw landing tables).

Memory Map: What is an Append-Only Stream? -> insert events only -> lower overhead -> no delete visibility -> external table fit -> limitation [SF_02_Quick_Recall.md:132].

What is an Append-Only Stream?

Tracks only INSERTs, not UPDATEs or DELETEs. Lighter weight (less metadata overhead). Use when your source table is append-only (like Bronze raw landing tables).

Answer First: After a successful DML transaction that consumes the stream (usually inside a Task). The consumed rows are no longer in the stream β€” new changes accumulate from that point forward.

Memory Map: When does a Stream "advance"? -> transaction commits -> consumed rows disappear -> rollback preserves offset -> repeatable read pattern -> monitoring [SF_02_Quick_Recall.md:135].

When does a Stream "advance"?

After a successful DML transaction that consumes the stream (usually inside a Task). The consumed rows are no longer in the stream β€” new changes accumulate from that point forward.

SECTION 3: TASKS

🧠 Memory Map: Task DAG

TASK DAG"Pipeline of SQL steps, like Databricks Workflows"
ROOT TASK
Has SCHEDULE (or trigger)
Is the starting point of the DAG
CHILD TASKS
Have AFTER parent_task (run when parent succeeds)
Multiple children allowed (fan-out)
No schedule (inherit from root)
IMPORTANT RULE
For a new graph: resume desired children before root
OR call SYSTEM$TASK_DEPENDENTS_ENABLE(root) to resume the graph recursively
SERVERLESS TASKS
No WAREHOUSE clause→Snowflake manages compute
cost depends on measured workload consumption than warehouse-based tasks
Good for: lightweight processing, simple SQL
TASK HISTORY CHECK
SELECT * FROM INFORMATION_SCHEMA.TASK_HISTORY(TASK_NAME => 'MY_TASK');

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: A scheduled Snowflake object that runs a SQL statement (or stored procedure). Like a cron job inside Snowflake. Tasks can be chained into DAGs for multi-step pipelines.

Memory Map: What is a Task? -> scheduled SQL unit -> cron or dependency -> compute context -> suspend/resume lifecycle -> run history [SF_02_Quick_Recall.md:173].

What is a Task?

A scheduled Snowflake object that runs a SQL statement (or stored procedure). Like a cron job inside Snowflake. Tasks can be chained into DAGs for multi-step pipelines.

Answer First: Define dependencies with AFTER parent_task_name. For initial activation, resume each desired child before the root or call SYSTEM$TASK_DEPENDENTS_ENABLE on the root to enable the graph recursively.

Memory Map: How do you chain Tasks into a pipeline? -> root coordinator -> child dependencies -> enable order -> failure isolation -> graph history [SF_02_Quick_Recall.md:176].

How do you chain Tasks into a pipeline?

Define child dependencies with AFTER parent_task_name. Initially resume desired children before the root, or call SYSTEM$TASK_DEPENDENTS_ENABLE on the root to enable all dependents recursively.

Answer First: - Warehouse task: uses your virtual warehouse, same credit rate as queries.

Memory Map: What is the difference between warehouse-based and serverless tasks? -> named compute exposes sizing control -> managed compute targets completion automatically -> metering evidence decides operating cost [SF_02_Quick_Recall.md:179].

What is the difference between warehouse-based and serverless tasks?

  • Warehouse task: uses your virtual warehouse, same credit rate as queries
  • Serverless task: Snowflake manages compute, metered separately; compare actual workload cost, no warehouse needed
  • Use serverless for lightweight, frequent tasks

Answer First: SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY(TASK_NAME => 'task_name')) β€” shows status (SUCCEEDED/FAILED), start/end time, error messages.

Memory Map: How do you monitor task failures? -> TASK_HISTORY evidence -> error code -> notification integration -> retry policy -> suspend threshold [SF_02_Quick_Recall.md:184].

How do you monitor task failures?

SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY(TASK_NAME => 'task_name')) β€” shows status (SUCCEEDED/FAILED), start/end time, error messages.

SECTION 4: DYNAMIC TABLES

🧠 Memory Map: Dynamic Tables

🧠 DYNAMIC TABLE = "Self-maintaining ELT table"
DYNAMIC TABLE"Self-maintaining ELT table"
One statement replaces: stream + task + merge logic!
CREATE DYNAMIC TABLE silver_bookings
TARGET_LAG = '5 minutes' ← How stale is OK?
WAREHOUSE'ETL_WH'
AS SELECT ... FROM raw_bookings; ← What should it look like?
TARGET_LAG values:
'5 minutes'β†’best-effort maximum staleness target, not an interval
'1 hour'β†’permits up to roughly one hour of target staleness
'DOWNSTREAM'β†’no independent schedule; downstream dynamic-table refresh drives it
REFRESH MODES
AUTOdefault; Snowflake resolves it at creation to INCREMENTAL or FULL
INCREMENTALexplicitly requests change-based processing when the query supports it
FULLexplicitly requests complete reprocessing
CHECK: SELECT refresh_mode FROM INFORMATION_SCHEMA.DYNAMIC_TABLES;
If FULL→simplify query → might get INCREMENTAL
CHAIN THEM: DT_Silver reads raw→DT_Gold reads DT_Silver
Snowflake auto-detects dependency, refreshes in order!
⚠️WHEN NOT TO USE:
Γ— SCD Type 2 (need before/after UPDATE image β†’ use Streams+Tasks)
Γ— Latency < 1 minute (min lag = 60 seconds)
Γ— External functions or stored procedures in logic

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: A Snowflake table defined by a SELECT query and a TARGET_LAG. Its refresh mode defaults to AUTO, which Snowflake resolves at creation to INCREMENTAL or FULL. It can replace eligible declarative Streams + Tasks patterns; explicit CDC and procedural orchestration still have separate use cases.

Memory Map: What is a Dynamic Table? -> maintained query result -> target lag scheduling -> incremental eligibility -> warehouse choice -> dependency graph [SF_02_Quick_Recall.md:228].

What is a Dynamic Table?

A Snowflake table defined by a SELECT query and a TARGET_LAG. Its refresh mode defaults to AUTO, which Snowflake resolves at creation to INCREMENTAL or FULL. It can replace eligible declarative Streams + Tasks patterns; explicit CDC and procedural orchestration still have separate use cases.

Answer First: TARGET_LAG is a best-effort maximum-staleness target relative to base tables. Five minutes does not guarantee a five-minute refresh or SLA; actual lag can exceed the target, and the minimum value is one minute.

Memory Map: What is TARGET_LAG? -> staleness target -> refresh budget -> DOWNSTREAM trigger -> lag observation -> SLA wording [SF_02_Quick_Recall.md:231].

What is TARGET_LAG?

TARGET_LAG is a best-effort maximum-staleness target relative to base tables. '5 minutes' is not a fixed refresh interval or guarantee; actual lag can exceed it. The minimum value is one minute.

Answer First: Use Dynamic Tables for eligible declarative SQL transformations where Snowflake can manage refreshes from a freshness target. Use Streams + Tasks when you need explicit CDC consumption, procedural control, or operations unsupported by Dynamic Tables.

Memory Map: Dynamic Tables vs Streams + Tasks β€” when to use which? -> declarative table -> procedural stream task -> edge-case control -> maintenance burden -> rollback [SF_02_Quick_Recall.md:234].

Dynamic Tables vs Streams + Tasks β€” when to use which?

  • Dynamic Tables: 95% of ELT transformations β€” simpler, declarative, auto-managed
  • Streams + Tasks: SCD Type 2, latency < 1 min, complex stored procedures, external functions

Answer First: INCREMENTAL refresh processes changes since the prior refresh when the query supports that mode; FULL recomputes the complete result. AUTO is the default and selects one of those modes when the dynamic table is created.

Memory Map: What is INCREMENTAL refresh vs FULL refresh? -> incremental mode merges supported source changes -> full mode recomputes complete output -> resolved mode and change volume drive cost [SF_02_Quick_Recall.md:238].

What is INCREMENTAL refresh vs FULL refresh?

  • INCREMENTAL (preferred): Snowflake processes only changed rows β†’ faster, cheaper
  • FULL: reprocesses entire source table β†’ slower, more expensive, fallback only

Answer First: Automatically β€” you don't write MERGE logic. Snowflake detects which rows changed and updates the Dynamic Table accordingly. Much simpler than writing a Stream + MERGE task.

Memory Map: How does a Dynamic Table handle an UPDATE in source? -> source change detected -> refresh computes result -> old row replaced -> lag-dependent visibility -> history check [SF_02_Quick_Recall.md:242].

How does a Dynamic Table handle an UPDATE in source?

Automatically β€” you don't write MERGE logic. Snowflake detects which rows changed and updates the Dynamic Table accordingly. Much simpler than writing a Stream + MERGE task.

SECTION 5: PERFORMANCE

🧠 Memory Map: Performance Tuning

🧠 PERFORMANCE CHECKLIST = "CQMWS"
PERFORMANCE CHECKLIST"CQMWS"
1. CLUSTERING (C):
Problem: queries scan many partitions (bad pruning)
Fix: ALTER TABLE t CLUSTER BY (filter_column)
Check: SYSTEM$CLUSTERING_INFORMATION→depth > 6 = recluster needed
2. QUERY PROFILE (Q):
Snowflake UI→Query History → click query → Query Profile
Look for: "Spilling to disk"β†’more memory (bigger WH)
"Partitions scanned >> total"β†’need clustering
"Bytes from cache" low→cache cold → don't suspend WH
3. MATERIALIZED VIEWS (M):
Problem: same heavy aggregation query runs 1000 times/day
Fix: CREATE MATERIALIZED VIEW mv AS SELECT ...GROUP BY...
Result: query hits MV instead of raw table→100x faster
4. WAREHOUSE SIZE (W):
Scale UP: queries individually slow→M→L→XL
Scale OUT: many users queuing→add clusters (multi-cluster)
⚠️Spilling to disk = DEFINITELY scale up!
5. SEARCH OPTIMIZATION (S):
Problem: WHERE id = 'specific_value' on massive unordered table
Fix: ALTER TABLE t ADD SEARCH OPTIMIZATION;
Use for: point lookups, equality on high-cardinality columns
NOT for: range queries (use clustering instead)

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: Visual execution tree in Snowflake UI showing how a query ran β€” which operators ran, how long each took, bytes scanned, spill to disk. Used to identify bottlenecks.

Memory Map: What is Query Profile? -> operator timeline -> scan versus spill -> skew evidence -> warehouse or SQL fix -> benchmark [SF_02_Quick_Recall.md:286].

What is Query Profile?

Visual execution tree in Snowflake UI showing how a query ran β€” which operators ran, how long each took, bytes scanned, spill to disk. Used to identify bottlenecks.

Answer First: The virtual warehouse ran out of memory data was written to SSD. Much slower than in-memory. Fix: scale UP to a larger warehouse size.

Memory Map: What does "spilling to disk" mean? -> operator memory becomes insufficient -> intermediate data moves to local or remote storage -> profile evidence justifies memory or query reduction [SF_02_Quick_Recall.md:289].

What does "spilling to disk" mean?

The virtual warehouse ran out of memory β†’ data was written to SSD. Much slower than in-memory. Fix: scale UP to a larger warehouse size.

Answer First: A pre-computed table based on a SELECT query. Snowflake auto-refreshes it when source data changes. Best for: heavy aggregations queried repeatedly by many users.

Memory Map: What is a Materialized View? -> repeated aggregate -> storage tradeoff -> supported SQL limits -> maintenance cost -> rewrite proof [SF_02_Quick_Recall.md:292].

What is a Materialized View?

A pre-computed table based on a SELECT query. Snowflake auto-refreshes it when source data changes. Best for: heavy aggregations queried repeatedly by many users.

Answer First: A feature that builds an extra index structure for point-lookup queries (WHERE id = 'X', WHERE email = 'user@co.com'). Great for high-cardinality column equality searches.

Memory Map: What is Search Optimization Service? -> point lookup path -> search access service -> selective predicate fit -> service cost -> explain proof [SF_02_Quick_Recall.md:295].

What is Search Optimization Service?

A feature that builds an extra index structure for point-lookup queries (WHERE id = 'X', WHERE email = 'user@co.com'). Great for high-cardinality column equality searches.

Answer First: - Clustering key range queries (WHERE date BETWEEN ... AND ...), sorted scans.

Memory Map: Clustering key vs Search Optimization β€” when to use which? -> range scans use clustering -> point lookups use search -> cost signal -> remove if unused -> query proof [SF_02_Quick_Recall.md:298].

Clustering key vs Search Optimization β€” when to use which?

  • Clustering key β†’ range queries (WHERE date BETWEEN ... AND ...), sorted scans
  • Search Optimization β†’ exact lookups (WHERE id = 'X'), unordered high-cardinality columns

🧠 FINAL REVISION β€” Day 2 Summary Card

πŸ“ Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               DAY 2: PIPELINES & PERFORMANCE                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                  β”‚
β”‚  LOADING = "CSP": COPY INTO β†’ Snowpipe β†’ Snowpipe Streaming      β”‚
β”‚  COPY INTO: batch, load-metadata-aware; suited to planned batch loading                         β”‚
β”‚  Snowpipe: auto on file arrival, ~1 min latency                 β”‚
β”‚  Snowpipe Streaming: push API, seconds-scale ingestion via the current SDK or REST architecture                β”‚
β”‚                                                                  β”‚
β”‚  STREAMS: track INSERT/UPDATE/DELETE on tables                  β”‚
β”‚  UPDATE = TWO rows: DELETE(old) + INSERT(new)                   β”‚
β”‚  Filter new value: METADATA$ACTION='INSERT' AND ISUPDATE=TRUE   β”‚
β”‚  Types: Standard (all) / Append-only (insert only)              β”‚
β”‚                                                                  β”‚
β”‚  TASKS: scheduled SQL + AFTER chain = pipeline DAG              β”‚
β”‚  New graph: children before root, or recursive enable function  β”‚
β”‚  Serverless tasks = cost depends on measured workload consumption, no warehouse                  β”‚
β”‚                                                                  β”‚
β”‚  DYNAMIC TABLES: declarative, can simplify eligible declarative pipelines      β”‚
β”‚  TARGET_LAG = best-effort staleness target (min 1 minute)       β”‚
β”‚  INCREMENTAL refresh = only processes changes (preferred)       β”‚
β”‚  ⚠️ Cannot do SCD Type 2 β†’ use Streams+Tasks for that          β”‚
β”‚                                                                  β”‚
β”‚  SNOWPARK: Python/Java/Scala DataFrame API in Snowflake         β”‚
β”‚  Pushes computation to Snowflake β€” no data leaves               β”‚
β”‚  UDFs: Python functions run inside Snowflake                    β”‚
β”‚  2026: Intelligent Hybrid Execution (auto local vs cloud)       β”‚
β”‚                                                                  β”‚
β”‚  PERFORMANCE = "CQMWS":                                         β”‚
β”‚  Clustering β†’ fix partition pruning (range queries)             β”‚
β”‚  Query Profile β†’ find bottleneck (spill? pruning? concurrency?) β”‚
β”‚  Materialized Views β†’ pre-compute aggregations                  β”‚
β”‚  Warehouse β†’ scale UP (slow) or OUT (concurrent users)         β”‚
β”‚  Search Optimization β†’ fix point lookups (= equality)          β”‚
β”‚                                                                  β”‚
β”‚  TOP 5 THINGS TO SAY IN INTERVIEW:                               β”‚
β”‚  1. "Snowpipe for near-real-time, COPY INTO for batch"          β”‚
β”‚  2. "Streams track CDC: UPDATE = DELETE+INSERT pair"            β”‚
β”‚  3. "Dynamic Tables replace most Streams+Tasks β€” declarative"   β”‚
β”‚  4. "Snowpark: Python that runs INSIDE Snowflake compute"       β”‚
β”‚  5. "CQMWS checklist: Clustering, Query Profile, MV, WH, Search"β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Advanced

Snowflake Security, Sharing, and Cost

#

Snowflake Security, Sharing, and Cost

Answer First: Operate Snowflake with least-privilege role hierarchies, policy-driven data controls, deliberate sharing boundaries, and cost decisions tied to metering evidence.

Memory Map: role -> privilege -> policy -> share -> meter -> budget -> verify availability.

Day 3: Security, Data Sharing, Cost & New Features 2026

βœ… Pro Tip
Time: 5-6 hours | Priority: HIGH β€” Security + new features differentiate senior candidates Context: GDPR compliance, multiple airline partners, travel data governance Approach: Simple explanation β†’ analogy β†’ technical depth β†’ code β†’ interview tip

SECTION 1: RBAC β€” ROLE-BASED ACCESS CONTROL (1 hour)

Answer First: RBAC (Role-Based Access Control) is how Snowflake controls who can access what. Instead of giving permissions directly to users, you give permissions to roles, and then assign roles to users. This makes it easy to manage 1000 users β€” change the role once, all users inheriting it are updated.

Memory Map: What is RBAC in Snowflake? What are the system roles? -> role graph -> least-privilege grants -> ownership hierarchy -> secondary role caveat -> access history [SF_03_Security_Sharing_New.md:11].

Q1: What is RBAC in Snowflake? What are the system roles?

Simple Explanation: RBAC (Role-Based Access Control) is how Snowflake controls who can access what. Instead of giving permissions directly to users, you give permissions to roles, and then assign roles to users. This makes it easy to manage 1000 users β€” change the role once, all users inheriting it are updated.

Real-world analogy: In a hotel, instead of giving each employee their own set of physical keys, you give them a "key card type" (role). Reception key cards open lobby, rooms, storage. Manager cards open everything. If you change what a Reception card can open, ALL receptionists are automatically updated.

The core account-level role hierarchy (organization roles also exist):

πŸ—‚οΈACCOUNTADMIN (top of hierarchy β€” most powerful)
β”‚ Owns everything. See billing, account settings, all objects.
β”‚ ⚠️ NEVER use for daily work. Reserved for 2-3 senior admins only.
β”‚ ⚠️ Do NOT set as default role for any user!
SECURITYADMIN
β”‚ Can create and manage ALL roles and users
β”‚ Grants/revokes privileges on objects (MANAGE GRANTS)
β”‚ Used for: creating custom roles, assigning privileges
USERADMIN
β”‚ Can create users and roles ONLY
β”‚ Cannot grant privileges on data objects
β”‚ Used for: onboarding new employees
SYSADMIN
β”‚ Can create warehouses, databases, schemas, tables
β”‚ All custom roles should inherit UP to SYSADMIN
β”‚ Used for: creating all data infrastructure
β”‚ ⚠️ Best practice: custom roles should ultimately be owned by SYSADMIN
PUBLIC
Default role given to ALL users automatically
Minimum possible access
Do NOT grant sensitive data to PUBLIC!
sql
-- CREATING A CUSTOM ROLE HIERARCHY (best practice)
USE ROLE USERADMIN;

-- Create domain roles
CREATE ROLE bookings_read_role;       -- Can only read booking data
CREATE ROLE bookings_write_role;      -- Can read + write
CREATE ROLE analyst_role;             -- Cross-domain read access

-- Grant privileges to roles (done by SECURITYADMIN)
USE ROLE SECURITYADMIN;

GRANT USAGE ON DATABASE analytics_db TO ROLE bookings_read_role;
GRANT USAGE ON SCHEMA analytics_db.bookings TO ROLE bookings_read_role;
GRANT SELECT ON ALL TABLES IN SCHEMA analytics_db.bookings TO ROLE bookings_read_role;
-- Future tables: automatically grant when new tables are created
GRANT SELECT ON FUTURE TABLES IN SCHEMA analytics_db.bookings TO ROLE bookings_read_role;

-- Hierarchy: write role inherits from read role
GRANT ROLE bookings_read_role TO ROLE bookings_write_role;
GRANT INSERT, UPDATE ON ALL TABLES IN SCHEMA analytics_db.bookings TO ROLE bookings_write_role;

-- Analyst role gets read across schemas
GRANT ROLE bookings_read_role TO ROLE analyst_role;

-- Best practice: assign custom roles UP to SYSADMIN (so SYSADMIN owns them)
GRANT ROLE bookings_read_role TO ROLE SYSADMIN;
GRANT ROLE bookings_write_role TO ROLE SYSADMIN;

-- Assign roles to users
GRANT ROLE analyst_role TO USER krishna_yadav;
GRANT ROLE bookings_write_role TO USER data_pipeline_sp;  -- Service Principal

-- User switches roles
USE ROLE analyst_role;
SELECT * FROM analytics_db.bookings.fact_flights;  -- Works!

Interview tip: "At a large enterprise with 200+ engineers, I'd design 3 tiers of roles: functional roles (bookings_reader, flights_writer), environment roles (prod_access, staging_access), and team roles (data_engineering_role, analytics_role). Team roles inherit functional roles. Engineers are assigned team roles. Separation of duties: SECURITYADMIN manages roles, SYSADMIN manages objects."

Answer First: Dynamic Data Masking hides sensitive column values from users who shouldn't see them β€” WITHOUT changing the actual stored data. The mask is applied at query time based on the user's role.

Memory Map: What is Data Masking? How does it work? -> policy expression -> context functions -> column attachment -> role-based reveal -> caller test [SF_03_Security_Sharing_New.md:90].

Q2: What is Data Masking? How does it work?

Simple Explanation: Dynamic Data Masking hides sensitive column values from users who shouldn't see them β€” WITHOUT changing the actual stored data. The mask is applied at query time based on the user's role.

Real-world analogy: Imagine a table with passenger emails. You put a one-way mirror on the email column. Most people see a reflection (masked value). HR managers see through the mirror (real value). The data itself is unchanged β€” the mirror changes based on who's looking.

sql
-- STEP 1: Create a masking policy
CREATE MASKING POLICY email_mask AS (val STRING) RETURNS STRING ->
    CASE
        WHEN CURRENT_ROLE() IN ('HR_ROLE', 'PRIVACY_OFFICER_ROLE')
            THEN val                        -- Show full email to privileged roles
        WHEN CURRENT_ROLE() IN ('ANALYST_ROLE')
            THEN REGEXP_REPLACE(val, '.+\@', '***@')  -- Show ***@domain.com
        ELSE
            '**REDACTED**'                 -- Everyone else: fully redacted
    END;
-- This policy is a SQL function β€” runs at query time for every row

-- STEP 2: Apply masking policy to a column
ALTER TABLE passengers
    MODIFY COLUMN email
    SET MASKING POLICY email_mask;
-- Now the email column is masked based on the querying role

-- Test: as ANALYST_ROLE
USE ROLE analyst_role;
SELECT email FROM passengers;
-- Returns: ***@gmail.com (masked)

-- Test: as HR_ROLE
USE ROLE hr_role;
SELECT email FROM passengers;
-- Returns: krishna@gmail.com (real value)

-- MULTIPLE PII COLUMNS:
ALTER TABLE passengers MODIFY COLUMN phone SET MASKING POLICY phone_mask;
ALTER TABLE passengers MODIFY COLUMN passport_no SET MASKING POLICY passport_mask;

-- VIEW: See all masking policies applied
SELECT * FROM INFORMATION_SCHEMA.POLICY_REFERENCES
WHERE POLICY_KIND = 'MASKING_POLICY';

Answer First: Row Access Policies control which ROWS a user can see β€” different users see different rows from the same table. Column masking = show/hide columns. Row Access = show/hide rows.

Memory Map: What are Row Access Policies? -> row predicate -> mapping table -> policy attachment -> CURRENT_ROLE evaluation -> query diff [SF_03_Security_Sharing_New.md:137].

Q3: What are Row Access Policies?

Simple Explanation: Row Access Policies control which ROWS a user can see β€” different users see different rows from the same table. Column masking = show/hide columns. Row Access = show/hide rows.

Real-world analogy: At a travel platform, multiple airline partners all share the same bookings table. Lufthansa should ONLY see their own bookings, not Air India's. Row Access Policy = a security gate on every row that checks "is this your booking?" before letting you through.

sql
-- STEP 1: Create a mapping table (user role β†’ airline they can see)
CREATE TABLE airline_access_mapping (
    role_name     VARCHAR,
    airline_code  VARCHAR
);
INSERT INTO airline_access_mapping VALUES
    ('LUFTHANSA_ROLE', 'LH'),
    ('AIR_INDIA_ROLE', 'AI'),
    ('EMIRATES_ROLE',  'EK'),
    ('ADMIN_ROLE',     NULL);    -- NULL = see ALL airlines

-- STEP 2: Create Row Access Policy
CREATE ROW ACCESS POLICY airline_row_policy
    AS (airline_code VARCHAR) RETURNS BOOLEAN ->
    EXISTS (
        SELECT 1
        FROM airline_access_mapping m
        WHERE m.role_name = CURRENT_ROLE()
          AND (m.airline_code = airline_code   -- Match role to airline
               OR m.airline_code IS NULL)       -- Or admin (sees all)
    );

-- STEP 3: Apply to table
ALTER TABLE bookings
    ADD ROW ACCESS POLICY airline_row_policy ON (airline_code);

-- Test: Lufthansa user
USE ROLE LUFTHANSA_ROLE;
SELECT * FROM bookings;  -- Returns ONLY LH bookings, even though table has all airlines

-- Test: Admin
USE ROLE ADMIN_ROLE;
SELECT * FROM bookings;  -- Returns ALL bookings

SECTION 2: DATA SHARING (1 hour)

Answer First: Secure Data Sharing lets you share your Snowflake data with another Snowflake account β€” WITHOUT copying data. The recipient queries your tables directly, always getting live data. They pay for their own compute; you pay for your storage.

Memory Map: What is Secure Data Sharing? How does it work? -> share object provider -> consumer database -> no data copy -> compute isolation -> revoke audit [SF_03_Security_Sharing_New.md:184].

Q4: What is Secure Data Sharing? How does it work?

Simple Explanation: Secure Data Sharing lets you share your Snowflake data with another Snowflake account β€” WITHOUT copying data. The recipient queries your tables directly, always getting live data. They pay for their own compute; you pay for your storage.

Real-world analogy: Instead of emailing a spreadsheet copy to a partner airline (stale data, security risk, multiple copies), you give them a secure link to YOUR Google Sheet. They always see the latest version. You control what they can access. No copy exists.

sql
-- PROVIDER SIDE (travel platform shares booking summary with Lufthansa)

-- Step 1: Create a share object
CREATE SHARE lufthansa_share
    COMMENT = 'Lufthansa booking analytics share';

-- Step 2: Grant database and schema to share
GRANT USAGE ON DATABASE analytics_db TO SHARE lufthansa_share;
GRANT USAGE ON SCHEMA analytics_db.bookings TO SHARE lufthansa_share;

-- Step 3: Grant specific tables/views to share (NOT entire database)
GRANT SELECT ON VIEW analytics_db.bookings.lufthansa_bookings_vw TO SHARE lufthansa_share;
-- Share a VIEW (not the raw table) so you control exactly what they see
-- View can filter: WHERE airline_code = 'LH' β€” Lufthansa sees only their data

-- Step 4: Add recipient (Lufthansa's Snowflake account)
ALTER SHARE lufthansa_share ADD ACCOUNTS = 'lufthansa.eu-west.snowflakecomputing.com';

-- RECIPIENT SIDE (Lufthansa's Snowflake account)
-- Step 1: Create database from the share
CREATE DATABASE travelco_share FROM SHARE travelco.lufthansa_share;

-- Step 2: Query it like a normal database!
SELECT * FROM travelco_share.bookings.lufthansa_bookings_vw;
-- Returns the provider's live data directly β€” no copy!
-- Lufthansa pays their own compute, the provider pays storage

Data Sharing types:

TypeUse Case
Direct ShareBoth parties have Snowflake accounts
Reader AccountRecipient doesn't have Snowflake β€” Snowflake creates a managed account for them
Data MarketplacePublish datasets publicly for any Snowflake customer to discover
Data Clean RoomShare data for joint analysis WITHOUT revealing raw records (GDPR safe)

SECTION 3: COST MANAGEMENT

Answer First: Control cost by attributing warehouse, serverless, cloud-services, and storage usage; then right-size, suspend idle compute, set budgets or monitors, and verify savings in metering views.

Memory Map: How do you manage and optimize Snowflake costs? -> metering attributes compute and storage -> workload policies suspend and right-size -> budgets and monitors contain exceptions [SF_03_Security_Sharing_New.md:233].

Q5: How do you manage and optimize Snowflake costs?

The COST CONTROL FRAMEWORK ("WSCRA"):

WWarehouse optimization (right-size + auto-suspend)
SStorage optimization (time travel settings, transient tables)
CCredit monitoring (resource monitors + budget alerts)
RResource Monitors (hard limits on credit usage)
AArchitecture decisions (serverless where possible)
sql
-- W: WAREHOUSE OPTIMIZATION
ALTER WAREHOUSE etl_wh SET
    AUTO_SUSPEND = 120           -- Suspend after 2 minutes idle (default is 10 min)
    AUTO_RESUME = TRUE;          -- Auto-start on query (don't forget this!)

-- Create right-sized warehouses per workload
CREATE WAREHOUSE dev_wh   SIZE = 'XSMALL' AUTO_SUSPEND = 60;  -- Dev: tiny, fast suspend
CREATE WAREHOUSE bi_wh    SIZE = 'MEDIUM' AUTO_SUSPEND = 300;  -- BI: keep warm longer (cache!)
CREATE WAREHOUSE etl_wh   SIZE = 'LARGE'  AUTO_SUSPEND = 120;  -- ETL: large but fast suspend

-- S: STORAGE OPTIMIZATION
-- Transient tables: NO fail-safe (7-day window removed), cheaper storage
-- Use for: staging tables, temp tables, data you can reload
CREATE TRANSIENT TABLE staging_bookings (...);    -- No fail-safe period
CREATE TRANSIENT SCHEMA staging;                  -- All tables in schema are transient

-- Reduce time travel for non-critical tables (reduce storage cost)
ALTER TABLE staging_bookings SET DATA_RETENTION_TIME_IN_DAYS = 0;
ALTER TABLE audit_log SET DATA_RETENTION_TIME_IN_DAYS = 7;    -- Only 7 days
ALTER TABLE fact_bookings SET DATA_RETENTION_TIME_IN_DAYS = 30; -- 30 days for prod

-- C & R: RESOURCE MONITORS (spend limits with alerts)
CREATE RESOURCE MONITOR monthly_cap
    WITH CREDIT_QUOTA = 1000               -- 1000 credits per month max
    FREQUENCY = MONTHLY
    START_TIMESTAMP = IMMEDIATELY
    TRIGGERS
        ON 75 PERCENT DO NOTIFY            -- Email alert at 75% usage
        ON 90 PERCENT DO NOTIFY            -- Email alert at 90%
        ON 100 PERCENT DO SUSPEND;         -- Auto-suspend all warehouses at 100%!

ALTER WAREHOUSE bi_wh SET RESOURCE_MONITOR = monthly_cap;
-- Now BI warehouse auto-suspends if team exceeds 1000 credits/month

Cost breakdown reference:

🧠 SNOWFLAKE COST = COMPUTE + STORAGE + CLOUD SERVICES
SNOWFLAKE COSTCOMPUTE + STORAGE + CLOUD SERVICES
COMPUTE (60-80% of total cost)
Credits consumed = warehouse size Γ— hours running
XS1 credit/hr, S β†’ 2, M β†’ 4, L β†’ 8, XL β†’ 16, 2XL β†’ 32...
Best save: auto-suspend quickly, right-size warehouses
STORAGE (10-20% of total)
~$23/TB/month (on-demand), ~$15/TB/month (capacity pricing)
Time travel + fail-safe = extra storage for old versions
Best save: transient tables for staging, reduce TT on temp data
CLOUD SERVICES (0-10% of total)
Result cache hits, metadata reads, RBAC checks
FREE if < 10% of compute credits
If > 10%: billed at ~$0.70/credit
Best save: usually not worth worrying about
COST RANKING (most β†’ least expensive mistakes)
1. Forgetting to suspend warehouses (idle compute)
2. Too high auto-suspend (warehouse idles for hours)
3. Wrong warehouse size (XL for a simple query)
4. Excessive time travel on large tables (storage cost)
5. Not using transient tables for staging

SECTION 4: NEW FEATURES 2025-2026

Answer First: Snowflake had a massive product year in 2025-2026, moving hard into AI and open formats. Key themes: AI-native (Cortex AI everywhere), open format (Iceberg/Polaris), and OLTP (Hybrid Tables). Mentioning these in interviews shows you're current.

Memory Map: What are the major Snowflake features from 2025-2026? -> official availability -> workload fit -> migration risk -> cost guardrail -> pilot metric [SF_03_Security_Sharing_New.md:314].

Q6: What are the major Snowflake features from 2025-2026?

Simple Explanation: Snowflake had a massive product year in 2025-2026, moving hard into AI and open formats. Key themes: AI-native (Cortex AI everywhere), open format (Iceberg/Polaris), and OLTP (Hybrid Tables). Mentioning these in interviews shows you're current.

Answer First: Gen2 standard warehouses use newer hardware and software optimizations; availability, consumption, and performance vary, so benchmark the target workload and region.

Memory Map: Gen 2 Warehouses (2025) -> generation selects newer execution resources -> regional support constrains adoption -> workload benchmark validates price-performance [SF_03_Security_Sharing_New.md:321].

Gen 2 Warehouses (2025)

Gen 2 = Next-generation virtual warehouses, designed for workload-dependent performance improvements
Same pricing as Gen 1
Better hardware + software optimizations
Especially faster for: MERGE, UPDATE, DELETE, large table scans
Iceberg table scans 1.9x faster vs managed Spark
HOW TO USE
CREATE WAREHOUSE my_wh
WAREHOUSE_TYPE = 'STANDARD' -- Gen 2 by default for new warehouses
WAREHOUSE_SIZE = 'LARGE';
-- Existing warehouses: can migrate to Gen 2 (Snowflake migrating automatically)

Answer First: Cortex AI exposes managed AI capabilities in Snowflake, but model, function, region, security, and cost availability must be verified for the target account.

Memory Map: Cortex AI (GA 2025 expanded 2026) -> model function surface -> governed inputs -> region availability -> cost and latency -> prompt audit [SF_03_Security_Sharing_New.md:337].

Cortex AI (GA 2025 β†’ expanded 2026)

Cortex AI = Snowflake's AI layer β€” run LLMs directly in SQL
CORTEX FUNCTIONS
SNOWFLAKE.CORTEX.COMPLETE('llama3-70b', prompt) -- Chat/generation
SNOWFLAKE.CORTEX.SUMMARIZE(text) -- Summarize text
SNOWFLAKE.CORTEX.SENTIMENT(text) -- -1 to 1 sentiment
SNOWFLAKE.CORTEX.TRANSLATE(text, 'en', 'fr') -- Translation
SNOWFLAKE.CORTEX.CLASSIFY_TEXT(text, [labels]) -- Classification
CORTEX SEARCH (GA March 12, 2026)
Hybrid search on text columns (keyword + semantic)
Supports MULTIPLE searchable columns per service (new 2026!)
Pre-computed embeddings (bring your own vector, new 2026!)
CORTEX ANALYST
Natural language queries→SQL → results
Business users ask: "What was revenue last month?"β†’Snowflake runs SQL
sql
-- Use Cortex AI in a SQL query
SELECT
    booking_id,
    customer_feedback,
    SNOWFLAKE.CORTEX.SENTIMENT(customer_feedback)          AS sentiment_score,
    -- Returns -1 (negative) to +1 (positive)
    SNOWFLAKE.CORTEX.SUMMARIZE(customer_feedback)          AS feedback_summary,
    SNOWFLAKE.CORTEX.CLASSIFY_TEXT(customer_feedback,
        ['complaint', 'compliment', 'inquiry'])             AS feedback_category
FROM customer_feedback_table
WHERE booking_date > '2026-01-01';
-- ALL processing happens inside Snowflake β€” no API calls, no data leaving

Answer First: Iceberg tables and Polaris provide open table-format and catalog interoperability; validate ownership mode, engine compatibility, refresh behavior, and governance boundaries.

Memory Map: Apache Iceberg Tables + Polaris Open Catalog (GA 2025-2026) -> open table format -> catalog interoperability -> Snowflake-managed access -> cross-engine governance -> compatibility test [SF_03_Security_Sharing_New.md:374].

Apache Iceberg Tables + Polaris Open Catalog (GA 2025-2026)

PROBLEM IT SOLVES
"I have data in S3/ADLS in open format (Parquet+Iceberg)
and want to query it from BOTH Snowflake AND Spark/Databricks/Athena
without copying data or maintaining two systems."
SOLUTION: Snowflake Iceberg Tables
Data stored in YOUR storage (ADLS Gen2, S3, GCS)
Open format: Apache Iceberg (any engine can read)
Snowflake manages metadata (catalog) + provides SQL interface
External engines (Databricks, Spark, Athena) can also read same files
POLARIS OPEN CATALOG (GA 2025)
Snowflake's managed Apache Polaris (Iceberg REST catalog)
ANY Iceberg-compatible engine can connect: Spark, Trino, Flink, Databricks
Single catalog, multiple engines, same data
2026 NEW: Iceberg tables now support Azure Data Lake Storage Gen2 (Preview, March 2026)
Read and write Iceberg from ADLS Gen2 natively
Huge for Azure-first enterprises!
sql
-- Create an Iceberg table (data in YOUR ADLS, Snowflake manages catalog)
CREATE ICEBERG TABLE iceberg_bookings (
    booking_id    VARCHAR,
    booking_date  DATE,
    airline_code  VARCHAR,
    amount        NUMBER(10,2)
)
    CATALOG = 'SNOWFLAKE'              -- Snowflake is the catalog
    EXTERNAL_VOLUME = 'my_adls_vol'   -- Where files stored in ADLS
    BASE_LOCATION = 'bookings/';      -- Path within volume
-- Now both Snowflake AND Databricks can read the same Parquet+Iceberg files!

Answer First: Hybrid Tables add transactional row-serving behavior alongside analytics; use them only after validating regional availability, quotas, latency, and the transactional access pattern.

Memory Map: Hybrid Tables / Unistore (GA 2025) -> row-oriented workload -> primary-key access -> transactional limits -> HTAP boundary -> latency proof [SF_03_Security_Sharing_New.md:412].

Hybrid Tables / Unistore (GA 2025)

PROBLEM: Snowflake is OLAP (analytics). What about OLTP (transactions)?
Traditional Snowflake: slow for: SELECT by single ID, many small inserts/updates
Hybrid Tables: solves this!
HYBRID TABLERow store + Column store in one table
Row store: fast for point lookups (WHERE id = 'X') β€” like a PostgreSQL table
Column store: fast for analytics (SUM, GROUP BY) β€” like a Snowflake table
BOTH: in one table, Snowflake manages automatically
USE CASES
βœ“ Operational apps that need real-time + analytics together
βœ“ Booking system: INSERT new booking (OLTP) + analytics on same table (OLAP)
βœ“ Avoid ETL from OLTP DB to analytics platform
SUPPORTS: Primary keys, unique constraints, foreign keys, indexes
sql
-- Create a Hybrid Table (OLTP+OLAP)
CREATE HYBRID TABLE live_bookings (
    booking_id    VARCHAR PRIMARY KEY,    -- Primary key (enforced, indexed)
    passenger_id  VARCHAR,
    booking_date  DATE,
    amount        NUMBER(10,2),
    status        VARCHAR,
    INDEX idx_passenger (passenger_id)    -- Secondary index (fast lookup)
);

-- Fast single-row lookup (OLTP-style)
SELECT * FROM live_bookings WHERE booking_id = 'BK12345678';
-- Uses row store β†’ milliseconds response

-- Analytics (OLAP-style)
SELECT DATE_TRUNC('month', booking_date), SUM(amount)
FROM live_bookings
GROUP BY 1;
-- Uses column store β†’ fast scan

Answer First: Snowflake Postgres provides managed Postgres instances on dedicated virtual machines and is GA only in selected AWS and Azure regions as of the cited 2026 release note.

Memory Map: Snowflake Postgres (GA February 2026) -> managed Postgres surface -> selected regions -> application fit -> replication pathway -> GA caveat [SF_03_Security_Sharing_New.md:454].

Snowflake Postgres (GA February 2026)

WHAT: Managed PostgreSQL database instances INSIDE Snowflake
= Create + manage Postgres databases directly from Snowflake account
= Each instance runs a full Postgres server on dedicated VM
= Data stays in your Snowflake account
WHY: Many apps need Postgres (ORM, ACID, row-level operations)
Now you can run Postgres AND Snowflake analytics in ONE platform
USE CASE: Application database (Postgres) + Analytics (Snowflake) = same platform

SECTION 5: MOCK INTERVIEW β€” TOP 10 QUESTIONS

Q7: 10 Most-Likely Snowflake Interview Questions

Mock Q1: "How is Snowflake different from Redshift or Synapse?"

βœ… Pro Tip
"Snowflake has TRUE separation of compute and storage β€” multiple independent virtual warehouses can query the same data simultaneously without resource contention. Redshift and Synapse are tightly coupled: scaling storage requires scaling compute. Snowflake also has a unified platform for structured + semi-structured data (VARIANT), instant zero-copy cloning, and native cross-cloud support (AWS, Azure, GCP). Snowflake also has near-zero maintenance β€” no vacuuming, no manual compression, no statistics updates."

Mock Q2: "How would you design a data sharing solution for 200 airline partners?"

"I'd use Snowflake Secure Data Sharing with a dedicated view per airline:

  1. Create row-access-filtered views: WHERE airline_code = 'LH' β€” each airline sees only their data
  2. Create a Share per airline: CREATE SHARE lh_share; GRANT SELECT ON VIEW lh_view TO SHARE
  3. For airlines without Snowflake: create Reader Accounts (Snowflake manages a free account for them)
  4. For cross-airline analysis (anonymized): use Data Clean Rooms (GDPR-safe joint analytics) No data copies β€” always live. Revoke access instantly by removing from Share."

Mock Q3: "How do you handle GDPR right to be forgotten?"

"Two approaches: Hard delete or pseudonymization. Hard delete: DELETE FROM table WHERE passenger_id = 'P123' on all tables, then wait for natural time travel expiry (or set DATA_RETENTION = 0 temporarily). ⚠️ In Snowflake you CANNOT force time travel data deletion like Databricks VACUUM β€” you must wait for the retention period to expire. So set retention to 1 day or 0 days for GDPR-sensitive tables. Pseudonymization (preferred): Replace real PII with a hash/UUID at Silver layer. Analytics still work, but the original identity is gone. Easier to reverse pseudonymization if needed."

Mock Q4: "A query takes 10 minutes, how do you debug it?"

"Systematic approach using Snowflake's tools:

  1. Query Profile: identify slowest operator β€” table scan? join? aggregation?
  2. Check partition pruning: partitions_scanned vs partitions_total β€” high ratio = need clustering key
  3. Check for spill to disk: means warehouse too small β†’ scale up
  4. Check bytes from cache: low cache hit = warehouse suspended recently β†’ increase auto-suspend
  5. Result cache: if same query runs often β†’ should be using result cache (check why not)"

Mock Q5: "What's your experience with Streams and Tasks?"

"I've used Streams + Tasks for incremental ELT pipelines. A stream on Bronze table captures CDC events from our Oracle→Snowpipe pipeline. A Task runs every 5 minutes, reads the stream, and applies a MERGE to Silver table. For SCD Type 2 dimensions like passenger address history, I use Standard Streams (need both INSERT + DELETE for UPDATE operations to track old/new values). However, for simpler transformations, I now prefer Dynamic Tables — same result, one-tenth the code. I still use Streams+Tasks specifically for SCD Type 2 and sub-minute latency requirements."

Mock Q6: "How do Snowflake Virtual Warehouses scale?"

"Two axes: Scale UP (bigger size: M→L→XL) for slow individual queries — doubles compute each step. Scale OUT (multi-cluster warehouses: MIN=1, MAX=5) for concurrency — handles many users queuing. For BI dashboards with 500 analysts, I'd use multi-cluster with ECONOMY scaling policy (adds clusters at sustained load, removes quickly). For overnight ETL, single XL warehouse is more cost-efficient. Key: don't mix ETL and BI on same warehouse — workload isolation with separate warehouses."

Mock Q7: "What are Snowflake's new features you're excited about?"

"Three stand out for me in 2026:

  1. Gen 2 Warehouses β€” 2.1x performance on same pricing. Especially for MERGE operations on large tables, this directly cuts my ETL runtime without cost increase.
  2. Dynamic Tables β€” replaces complex Streams+Tasks patterns with declarative SQL. Reduced our Silver layer pipeline from 150 lines of procedural code to 3 CREATE DYNAMIC TABLE statements.
  3. Iceberg + Polaris Open Catalog with ADLS Gen2 support β€” This is huge for Azure-first companies. Our data lives in ADLS; now both Snowflake AND Databricks Spark can read the same Iceberg files without ETL between platforms."

Mock Q8: "How would you implement column-level security for PII?"

sql
-- Create masking policy
CREATE MASKING POLICY pii_email_mask AS (val STRING) RETURNS STRING ->
    CASE
        WHEN CURRENT_ROLE() IN ('PRIVACY_OFFICER', 'DATA_STEWARD') THEN val
        WHEN CURRENT_ROLE() IN ('ANALYST_ROLE') THEN REGEXP_REPLACE(val, '.+@', '***@')
        ELSE '**REDACTED**'
    END;

-- Apply to column
ALTER TABLE passengers MODIFY COLUMN email SET MASKING POLICY pii_email_mask;

-- Combine with Row Access Policy (airlines see only their rows + masked PII)
Masking policy = who sees real values. Row access = which rows they see. Both together = complete GDPR data governance.

Mock Q9: "COPY INTO vs INSERT β€” when to use which?"

"COPY INTO for bulk loading files (100K+ rows from a stage) β€” parallelized, parallel and load-metadata-aware. INSERT for small transactional inserts (1-1000 rows), or for Hybrid Tables (OLTP operations). Never use INSERT to load a CSV file β€” it's 100x slower than COPY INTO for large files."

Mock Q10: "How do you reduce Snowflake costs for a team of 200 engineers?"

"Three immediate wins: First, auto-suspend all warehouses aggressively (60-120 seconds for dev, 5 minutes for BI). Second, create separate warehouses per workload and right-size each (dev=XS, BI=M, ETL=L) β€” don't let everyone share one large warehouse. Third, use transient tables and zero-day time travel for staging data β€” 20-30% storage savings. Longer term: resource monitors with hard credit limits per team, tagging all warehouses with team+project for chargeback, and reviewing Query History weekly for poorly-written queries that consume excessive credits."

Day 3: Security, Sharing & New Features β€” Quick Recall Guide

⚑Must rememberπŸ”‘Key concept⚠️Common trap🧠Memory MapπŸ“One-liner

🧠 MASTER MEMORY MAP β€” Day 3

🧠 SECURITY = "RARM" (Role, Access, Row, Mask)
SECURITY"RARM" (Role, Access, Row, Mask)
RRBAC (Role-Based Access Control β€” roles, not users)
AACCOUNTADMIN hierarchy (five core account-hierarchy roles)
RRow Access Policies (filter rows per role)
MMasking Policies (hide column values per role)
5 CORE ACCOUNT ROLES = "ASUSP" (think: A Snowflake User Should Pick roles)
AACCOUNTADMIN (most powerful, use RARELY)
SSECURITYADMIN (manage roles + grants)
UUSERADMIN (create users + roles only)
SSYSADMIN (create DB/schema/table/warehouse)
PPUBLIC (everyone, minimum access)
COST CONTROL"WSCRA"
WWarehouses (right-size + auto-suspend)
SStorage (transient tables, reduce time travel)
CCredit monitoring (resource monitors)
RResource Monitors (hard spend limits)
AArchitecture (serverless where possible)
NEW 2025-2026 = "GCIHP"
GGen2 Warehouses (newer hardware and optimizations; region, consumption, and speed are workload-dependent)
CCortex AI (LLMs in SQL, Cortex Search GA March 2026)
IIceberg + Polaris (open format, cross-engine)
HHybrid Tables (OLTP + OLAP = Unistore)
PPostgres (managed Postgres inside Snowflake, GA Feb 2026)

SECTION 1: RBAC

🧠 Memory Map: Role Hierarchy

πŸ“ Architecture Diagram
          ACCOUNTADMIN  ← Top of pyramid, reserved for 2-3 people
               β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
   SECURITYADMIN   SYSADMIN   ← Most important admin roles
        β”‚               β”‚
   USERADMIN        Custom Role Hierarchy:
                         SYSADMIN
                           └── team_role (e.g., data_engineering)
                                 └── functional_role (e.g., bookings_reader)
                                       └── privileges on objects

RULE: Custom roles float UP to SYSADMIN
      So SYSADMIN (and ACCOUNTADMIN above it) always has oversight

WHO DOES WHAT:
    ACCOUNTADMIN β†’ billing, account settings, emergency only
    SECURITYADMIN β†’ grant/revoke privileges on objects
    USERADMIN β†’ create users, create roles (no data privileges)
    SYSADMIN β†’ create databases, schemas, tables, warehouses
    PUBLIC β†’ minimum, given to all users automatically

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: Role-Based Access Control β€” grant permissions to ROLES (not individual users), then assign roles to users. One role change updates all users who have it.

Memory Map: What is RBAC in Snowflake? -> privileges to roles -> roles to users -> active role context -> ownership transfer -> audit query [SF_03_Quick_Recall.md:71].

What is RBAC in Snowflake?

Role-Based Access Control β€” grant permissions to ROLES (not individual users), then assign roles to users. One role change updates all users who have it.

Answer First: The five core account-hierarchy roles are ACCOUNTADMIN, SECURITYADMIN, USERADMIN, SYSADMIN, and PUBLIC; organization, database, and application roles exist outside that mnemonic.

Memory Map: What are the 5 system-defined roles? -> ACCOUNTADMIN boundary -> SYSADMIN objects -> SECURITYADMIN grants -> USERADMIN identities -> ORGADMIN separate [SF_03_Quick_Recall.md:74].

What are the 5 system-defined roles?

ACCOUNTADMIN, SECURITYADMIN, USERADMIN, SYSADMIN, PUBLIC. ("ASUSP")

Answer First: - ACCOUNTADMIN: see billing, all objects, account settings (use sparingly!).

Memory Map: What does each system role do? -> object management -> user lifecycle -> security grants -> account break-glass -> custom-role overlay [SF_03_Quick_Recall.md:77].

What does each system role do?

  • ACCOUNTADMIN: see billing, all objects, account settings (use sparingly!)
  • SECURITYADMIN: manage grants (GRANT/REVOKE on all objects)
  • USERADMIN: create users and roles only (no data access)
  • SYSADMIN: create databases, schemas, warehouses, tables
  • PUBLIC: minimum role, auto-assigned to everyone

Answer First: Using ACCOUNTADMIN as the default role for data engineers. Best practice: grant ACCOUNTADMIN to 2-3 senior admins, set their DEFAULT ROLE to SYSADMIN. ACCOUNTADMIN should only be used when explicitly needed.

Memory Map: What is the #1 RBAC mistake? -> direct user grant -> hierarchy bypass -> audit complexity -> grant to role -> revoke cleanup [SF_03_Quick_Recall.md:84].

What is the #1 RBAC mistake?

Using ACCOUNTADMIN as the default role for data engineers. Best practice: grant ACCOUNTADMIN to 2-3 senior admins, set their DEFAULT ROLE to SYSADMIN. ACCOUNTADMIN should only be used when explicitly needed.

Answer First: GRANT SELECT ON FUTURE TABLES IN SCHEMA bookings TO ROLE analyst_role; β€” Automatically grants SELECT on any NEW tables created in that schema. Without this, every new table needs a manual grant.

Memory Map: What is FUTURE GRANTS? -> schema object template -> privilege inheritance -> ownership exceptions -> migration surprise -> SHOW GRANTS check [SF_03_Quick_Recall.md:87].

What is FUTURE GRANTS?

GRANT SELECT ON FUTURE TABLES IN SCHEMA bookings TO ROLE analyst_role; β€” Automatically grants SELECT on any NEW tables created in that schema. Without this, every new table needs a manual grant.

Answer First: USE ROLE analyst_role; β€” Switch to a different role in your session. Your access changes immediately.

Memory Map: How do you switch roles? -> USE ROLE context -> secondary role option -> worksheet session scope -> permission error debug -> least privilege [SF_03_Quick_Recall.md:90].

How do you switch roles?

USE ROLE analyst_role; β€” Switch to a different role in your session. Your access changes immediately.

πŸ”‘ MID-LEVEL QUESTIONS

Answer First: ACCOUNTADMIN (2-3 people: CTO, Lead Architect).

Memory Map: Design a role hierarchy for 200 engineers at a large enterprise -> functional roles -> environment roles -> service identities -> break-glass admin -> periodic review [SF_03_Quick_Recall.md:97].

Design a role hierarchy for 200 engineers at a large enterprise

πŸ—ΊοΈMemory Map
```
ACCOUNTADMIN (2-3 people: CTO, Lead Architect)
β”‚
SYSADMIN
data_engineering_role
bookings_writer_role (read+write bookings schema)
flights_writer_role (read+write flights schema)
β”‚
analytics_role
bookings_reader_role (read-only bookings)
flights_reader_role (read-only flights)
β”‚
airline_partner_role
lufthansa_role (row-filtered to LH data only)
air_india_role (row-filtered to AI data only)
Engineers β†’ assigned data_engineering_role
Analysts β†’ assigned analytics_role
Airline partners β†’ assigned their airline-specific role
```

SECTION 2: DATA MASKING & ROW ACCESS

🧠 Memory Map: Security Policies

🧠 MASKING POLICY = "Who sees WHAT value in a column"
MASKING POLICY"Who sees WHAT value in a column"
Different roles→see different values from SAME column
Example: email column β†’
HR_ROLE sees: krishna@gmail.com (real)
ANALYST_ROLE sees: ***@gmail.com (partial mask)
PUBLIC sees: **REDACTED** (fully hidden)
CREATE MASKING POLICY p AS (val STRING) RETURNS STRING ->
CASE WHEN CURRENT_ROLE() IN ('HR') THEN val ELSE '***' END;
ALTER TABLE t MODIFY COLUMN email SET MASKING POLICY p;
ROW ACCESS POLICY"Who sees WHICH ROWS in a table"
Different roles→see different rows from SAME table
Example: bookings table β†’
LH_ROLE sees: only rows WHERE airline_code = 'LH'
AI_ROLE sees: only rows WHERE airline_code = 'AI'
ADMIN sees: ALL rows
CREATE ROW ACCESS POLICY p AS (airline VARCHAR) RETURNS BOOLEAN ->
EXISTS (SELECT 1 FROM mapping WHERE role = CURRENT_ROLE() AND airline = airline);
ALTER TABLE bookings ADD ROW ACCESS POLICY p ON (airline_code);
COMBINED: Apply BOTH→airline partners see only their rows + masked PII

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: A column-level security feature that shows different values to different roles. HR sees real email, analysts see *@domain.com. Data is unchanged in storage β€” masking applies at query time.

Memory Map: What is Dynamic Data Masking? -> column policy -> caller context -> masked expression -> authorized reveal -> BI validation [SF_03_Quick_Recall.md:156].

What is Dynamic Data Masking?

A column-level security feature that shows different values to different roles. HR sees real email, analysts see ***@domain.com. Data is unchanged in storage β€” masking applies at query time.

Answer First: Controls which rows different roles can see. Lufthansa sees only their bookings, Air India sees only theirs, even from the same table. Applied via: ALTER TABLE t ADD ROW ACCESS POLICY p ON (airline_code).

Memory Map: What is a Row Access Policy? -> predicate function -> row filter bind -> mapping lookup -> owner testing -> EXPLAIN caution [SF_03_Quick_Recall.md:159].

What is a Row Access Policy?

Controls which rows different roles can see. Lufthansa sees only their bookings, Air India sees only theirs, even from the same table. Applied via: ALTER TABLE t ADD ROW ACCESS POLICY p ON (airline_code).

Answer First: - Column masking: controls WHAT VALUE you see in a specific column (hide PII).

Memory Map: Column masking vs Row Access β€” what's the difference? -> column redaction -> row filtering -> combined evaluation -> performance review -> test matrix [SF_03_Quick_Recall.md:162].

Column masking vs Row Access β€” what's the difference?

  • Column masking: controls WHAT VALUE you see in a specific column (hide PII)
  • Row Access Policy: controls WHICH ROWS you see (multi-tenant data isolation)

Answer First: CURRENT_ROLE() returns the active role of the user running the query. Used inside masking and row access policies to make decisions dynamically at query time.

Memory Map: How does CURRENT_ROLE() work in policies? -> active primary role -> secondary-role nuance -> mapping join -> deterministic predicate -> role simulation [SF_03_Quick_Recall.md:166].

How does CURRENT_ROLE() work in policies?

CURRENT_ROLE() returns the active role of the user running the query. Used inside masking and row access policies to make decisions dynamically at query time.

SECTION 3: DATA SHARING

🧠 Memory Map: Secure Data Sharing

🧠 DATA SHARING = "PSR model" (Provider, Share, Recipient)
DATA SHARING"PSR model" (Provider, Share, Recipient)
PProvider: owns the data (travel platform)
SShare object: defines what to share (tables/views)
RRecipient: Snowflake account that reads the data
No data is COPIED β€” recipient reads live from provider's storage!
STEPS
1. CREATE SHARE my_share;
2. GRANT USAGE ON DATABASE/SCHEMA/VIEW TO SHARE my_share;
3. ALTER SHARE my_share ADD ACCOUNTS = 'recipient.snowflake.com';
4. Recipient: CREATE DATABASE from SHARE;
TYPES
Direct Share→both have Snowflake accounts
Reader Account→recipient has NO Snowflake, Snowflake creates one
Data Marketplace→public listing any Snowflake user can discover
Data Clean Room→joint analytics without sharing raw PII (GDPR-safe)
KEY FACT: Provider pays STORAGE. Recipient pays COMPUTE.

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: Share live Snowflake data with another Snowflake account WITHOUT copying. Recipient queries your data directly using their own warehouse. No ETL, no copies, always fresh.

Memory Map: What is Secure Data Sharing? -> provider grants share objects without copying -> consumer database references live data -> consumer warehouse pays query compute [SF_03_Quick_Recall.md:202].

What is Secure Data Sharing?

Share live Snowflake data with another Snowflake account WITHOUT copying. Recipient queries your data directly using their own warehouse. No ETL, no copies, always fresh.

Answer First: A Snowflake-managed account created for a data recipient who doesn't have their own Snowflake. Snowflake creates and manages it; the recipient connects and queries shared data.

Memory Map: What is a Reader Account? -> provider-managed consumer -> share data only -> provider pays compute -> onboarding boundary -> usage monitor [SF_03_Quick_Recall.md:205].

What is a Reader Account?

A Snowflake-managed account created for a data recipient who doesn't have their own Snowflake. Snowflake creates and manages it; the recipient connects and queries shared data.

Answer First: A secure environment for joint data analysis without either party seeing the other's raw data. Example: a travel platform + airline analyze booking patterns without the platform seeing airline's customer list or vice versa. GDPR-safe.

Memory Map: What is a Data Clean Room? -> governed collaboration -> policy-protected joins -> aggregate outputs -> no raw exchange -> consent workflow [SF_03_Quick_Recall.md:208].

What is a Data Clean Room?

A secure environment for joint data analysis without either party seeing the other's raw data. Example: a travel platform + airline analyze booking patterns without the platform seeing airline's customer list or vice versa. GDPR-safe.

Answer First: Provider pays for storage. Recipient pays for their own compute (virtual warehouse). Provider's compute is NOT used for recipient queries.

Memory Map: Who pays for what in Data Sharing? -> provider funds retained storage and services -> consumer funds warehouse execution -> reader accounts shift compute billing to provider [SF_03_Quick_Recall.md:211].

Who pays for what in Data Sharing?

Provider pays for storage. Recipient pays for their own compute (virtual warehouse). Provider's compute is NOT used for recipient queries.

SECTION 4: COST MANAGEMENT

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: A Snowflake object that sets credit limits on warehouses. Can trigger: notify at 75%, suspend at 100%. Prevents surprise bills. Apply per warehouse or account-wide.

Memory Map: What is a Resource Monitor? -> credit quota tracks assigned warehouses -> thresholds notify or suspend -> account budgets cover broader serverless spending [SF_03_Quick_Recall.md:220].

What is a Resource Monitor?

A Snowflake object that sets credit limits on warehouses. Can trigger: notify at 75%, suspend at 100%. Prevents surprise bills. Apply per warehouse or account-wide.

Answer First: A table with NO fail-safe period (saves 7 days Γ— storage cost). Use for staging/temp data that can be reloaded. CREATE TRANSIENT TABLE staging_data (...).

Memory Map: What is a Transient Table? -> no fail-safe -> shorter recovery window -> storage cost reduction -> data criticality check -> retention policy [SF_03_Quick_Recall.md:223].

What is a Transient Table?

A table with NO fail-safe period (saves 7 days Γ— storage cost). Use for staging/temp data that can be reloaded. CREATE TRANSIENT TABLE staging_data (...).

Answer First: Not setting auto-suspend on warehouses. Warehouses running idle 24/7 consume credits even with no queries. Set auto-suspend to 60-120 seconds for dev, 5-10 minutes for BI.

Memory Map: What is the biggest Snowflake cost mistake? -> idle warehouse continues credit consumption -> auto-suspend closes unused intervals -> metering confirms eliminated runtime [SF_03_Quick_Recall.md:226].

What is the biggest Snowflake cost mistake?

Not setting auto-suspend on warehouses. Warehouses running idle 24/7 consume credits even with no queries. Set auto-suspend to 60-120 seconds for dev, 5-10 minutes for BI.

Answer First: 1. Transient tables for staging (no fail-safe).

Memory Map: How do you optimize storage cost? -> table type choice -> retention trim -> clone cleanup -> fail-safe awareness -> bytes audit [SF_03_Quick_Recall.md:229].

How do you optimize storage cost?

  1. Transient tables for staging (no fail-safe)
  2. Reduce time travel on non-critical tables (set to 0-1 day)
  3. Zero-copy clone for dev environments (no data duplication)
  4. Monitor: SNOWFLAKE.ACCOUNT_USAGE.TABLE_STORAGE_METRICS

SECTION 5: NEW 2025-2026 FEATURES

🧠 Memory Map: New Features

NEW FEATURES"GCIHP"
GGEN 2 WAREHOUSES (2025):
newer hardware and optimizations whose benefit is workload-dependent
Consult generation-specific consumption rates and benchmark the workload
New warehouses default to Gen 2 automatically
CCORTEX AI (GA 2025, expanded 2026):
SNOWFLAKE.CORTEX.COMPLETE/SUMMARIZE/SENTIMENT/TRANSLATE/CLASSIFY
Cortex Search GA March 12, 2026 (multi-column, custom embeddings)
Cortex Analyst: natural language→SQL → results
IICEBERG + POLARIS (2025 GA):
Iceberg Tables: data in YOUR cloud storage, Snowflake queries it
Polaris Open Catalog: ANY Iceberg engine can connect
March 2026: Iceberg on Azure ADLS Gen2 (Preview)
Result: Snowflake + Databricks read same files, no ETL!
HHYBRID TABLES (GA 2025):
Row store (OLTP speed) + Column store (OLAP speed) in ONE table
Supports: primary keys, secondary indexes, foreign keys
Use: operational apps + analytics on same data without ETL
PPOSTGRES (GA February 2026):
Managed PostgreSQL inside Snowflake account
Application database (Postgres) + Analytics (Snowflake) = one platform
Snowflake manages the VM, OS, backups

⚑ MUST KNOW DIRECT QUESTIONS

Answer First: Next-generation virtual warehouses with newer hardware and software optimizations for analytics and engineering workloads. Verify regional availability, generation-specific consumption, account defaults, and measured workload performance.

Memory Map: What are Gen 2 Warehouses? -> generation changes execution hardware and optimizations -> service table defines consumption -> regional benchmark proves workload benefit [SF_03_Quick_Recall.md:275].

What are Gen 2 Warehouses?

Next-generation virtual warehouses with newer hardware and software optimizations for analytics and engineering workloads. Verify regional availability, generation-specific consumption, account defaults, and measured workload performance.

Answer First: Snowflake's managed AI service. Run LLM functions directly in SQL: SNOWFLAKE.CORTEX.SENTIMENT(text), CORTEX.SUMMARIZE(text), CORTEX.COMPLETE('llama3', prompt). No data leaves Snowflake.

Memory Map: What is Cortex AI? -> SQL AI functions -> governed data input -> model availability -> token cost -> result review [SF_03_Quick_Recall.md:278].

What is Cortex AI?

Snowflake's managed AI service. Run LLM functions directly in SQL: SNOWFLAKE.CORTEX.SENTIMENT(text), CORTEX.SUMMARIZE(text), CORTEX.COMPLETE('llama3', prompt). No data leaves Snowflake.

Answer First: Hybrid search service (keyword + semantic vector search) on Snowflake text columns. GA March 12, 2026: now supports multiple searchable columns per service + pre-computed custom embeddings.

Memory Map: What is Cortex Search? What's new in 2026? -> text/vector index -> retrieval endpoint -> freshness window -> app integration -> relevance test [SF_03_Quick_Recall.md:281].

What is Cortex Search? What's new in 2026?

βœ… Pro Tip
Hybrid search service (keyword + semantic vector search) on Snowflake text columns. GA March 12, 2026: now supports multiple searchable columns per service + pre-computed custom embeddings.

Answer First: Tables where data lives in YOUR cloud storage (ADLS/S3) in open Apache Iceberg format. Snowflake manages the catalog. Both Snowflake AND external engines (Databricks, Spark, Trino) read the same files.

Memory Map: What are Iceberg Tables? -> external metadata -> open file layout -> Snowflake optimization -> catalog choice -> engine interoperability [SF_03_Quick_Recall.md:284].

What are Iceberg Tables?

Tables where data lives in YOUR cloud storage (ADLS/S3) in open Apache Iceberg format. Snowflake manages the catalog. Both Snowflake AND external engines (Databricks, Spark, Trino) read the same files.

Answer First: Snowflake's managed implementation of Apache Polaris β€” an open-source Iceberg REST catalog. Any Iceberg-compatible engine connects to it. One catalog, many engines, no data copies.

Memory Map: What is Polaris Open Catalog? -> open catalog service -> REST interoperability -> access control model -> Iceberg clients -> governance decision [SF_03_Quick_Recall.md:287].

What is Polaris Open Catalog?

Snowflake's managed implementation of Apache Polaris β€” an open-source Iceberg REST catalog. Any Iceberg-compatible engine connects to it. One catalog, many engines, no data copies.

Answer First: Snowflake tables that combine a row store (for fast OLTP point lookups) with a column store (for OLAP analytics). Supports primary keys, indexes, foreign keys. Use case: operational + analytics in one table.

Memory Map: What are Hybrid Tables? -> operational row lookup -> primary key enforcement -> transactional DML -> not analytic scan default -> design fit [SF_03_Quick_Recall.md:290].

What are Hybrid Tables?

Snowflake tables that combine a row store (for fast OLTP point lookups) with a column store (for OLAP analytics). Supports primary keys, indexes, foreign keys. Use case: operational + analytics in one table.

Answer First: Managed PostgreSQL databases running inside Snowflake (GA February 2026). Each instance is a dedicated Postgres server VM managed by Snowflake. Application DB + Snowflake analytics = one unified platform.

Memory Map: What is Snowflake Postgres? -> OLTP familiar API -> Snowflake-managed service -> region availability -> integration path -> workload split [SF_03_Quick_Recall.md:293].

What is Snowflake Postgres?

Managed PostgreSQL databases running inside Snowflake (GA February 2026). Each instance is a dedicated Postgres server VM managed by Snowflake. Application DB + Snowflake analytics = one unified platform.

🧠 FINAL REVISION β€” Day 3 Summary Card

πŸ“ Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               DAY 3: SECURITY, SHARING & NEW FEATURES             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                  β”‚
β”‚  RBAC = roles, not users. five core account-hierarchy roles: "ASUSP"               β”‚
β”‚  ACCOUNTADMIN = most powerful, use sparingly (⚠️ not daily use)  β”‚
β”‚  SECURITYADMIN = manage grants | SYSADMIN = create objects       β”‚
β”‚  Custom roles should inherit UP to SYSADMIN                     β”‚
β”‚                                                                  β”‚
β”‚  MASKING POLICY = different roles see different values           β”‚
β”‚  ROW ACCESS POLICY = different roles see different rows          β”‚
β”‚  Combine both = full data isolation (GDPR + multi-tenant)       β”‚
β”‚                                                                  β”‚
β”‚  DATA SHARING = PSR (Provider, Share, Recipient)                 β”‚
β”‚  No data copy β€” recipient reads live from provider storage       β”‚
β”‚  Provider pays storage, Recipient pays compute                  β”‚
β”‚  Reader Account = for recipients without Snowflake              β”‚
β”‚  Data Clean Room = joint analytics without raw PII exposure     β”‚
β”‚                                                                  β”‚
β”‚  COST = "WSCRA": Warehouses, Storage, Credits, Resource, Arch   β”‚
β”‚  ⚠️ Biggest mistake: forgetting auto-suspend!                    β”‚
β”‚  Transient tables = no fail-safe (cheaper storage)              β”‚
β”‚  Resource Monitors = hard credit limits per warehouse           β”‚
β”‚                                                                  β”‚
β”‚  NEW 2025-2026 = "GCIHP":                                        β”‚
β”‚  Gen2 (designed for workload-dependent performance improvements) | Cortex AI (LLM in SQL)                   β”‚
β”‚  Iceberg+Polaris (open format, cross-engine)                    β”‚
β”‚  Hybrid Tables (OLTP+OLAP) | Postgres (GA Feb 2026)            β”‚
β”‚  Iceberg on ADLS Gen2 (Preview March 2026 β€” great for Azure!)  β”‚
β”‚                                                                  β”‚
β”‚  TOP 5 THINGS TO SAY IN INTERVIEW:                               β”‚
β”‚  1. "RBAC: custom roles inherit up to SYSADMIN"                 β”‚
β”‚  2. "Masking = hide values; Row Access = hide rows (combine!)"  β”‚
β”‚  3. "Secure Sharing: live data, no copy, provider pays storage" β”‚
β”‚  4. "Resource monitors with hard limits prevent surprise bills" β”‚
β”‚  5. "Gen2, Dynamic Tables, Iceberg β€” shows I'm current in 2026" β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧠 SNOWFLAKE ULTRA CHEAT SHEET (Read 10 min before interview)

πŸ“ Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚             ALL 3 DAYS β€” SNOWFLAKE LAST-MINUTE RECALL             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                  β”‚
β”‚  ARCHITECTURE = 3 layers "BMS": Brain(Cloud Svcs) + Muscles(WH) β”‚
β”‚  + Storage. Key: compute & storage SEPARATE β†’ scale each alone  β”‚
β”‚  Micro-partitions: AUTO, 50-500 MB, min/max metadata β†’ pruning   β”‚
β”‚  Virtual WH: scale UP(slow query) vs OUT(many users)            β”‚
β”‚  Cache "RLS": Result(24h,free) β†’ Local(SSD,cleared on suspend)  β”‚
β”‚  Time Travel: 0-90 days | Fail-safe: 7 days (Snowflake only)   β”‚
β”‚  Clone: instant copy, no data duplicated, shared micro-parts    β”‚
β”‚  VARIANT: any JSON, access with col:key::VARCHAR, FLATTEN arrays β”‚
β”‚                                                                  β”‚
β”‚  PIPELINES: "CSP" = COPY INTO β†’ Snowpipe β†’ Snowpipe Streaming   β”‚
β”‚  Streams: track INSERT/UPDATE/DELETE (UPDATE=2 rows!)           β”‚
β”‚  Tasks: chain with AFTER; initially children then root, or recursive enable β”‚
β”‚  Dynamic Tables: declarative ELT (can simplify eligible declarative pipelines)  β”‚
β”‚  TARGET_LAG min = 1 minute, best-effort; AUTO chooses refresh mode β”‚
β”‚  Snowpark: Python DataFrames run INSIDE Snowflake               β”‚
β”‚  Performance: "CQMWS" = Cluster, Query profile, MV, WH, Search β”‚
β”‚                                                                  β”‚
β”‚  SECURITY: "RARM" = RBAC, ACCOUNTADMIN hierarchy, Row, Mask    β”‚
β”‚  5 roles "ASUSP": ACCOUNTADMIN, SEC, USERADMIN, SYS, PUBLIC    β”‚
β”‚  Masking = hide column values | Row Access = hide rows          β”‚
β”‚  Sharing: PSR, no copy, provider=storage, recipient=compute     β”‚
β”‚  Cost: auto-suspend!, transient tables, resource monitors       β”‚
β”‚                                                                  β”‚
β”‚  NEW 2026 "GCIHP": Gen2, Cortex AI, Iceberg/Polaris,           β”‚
β”‚  Hybrid Tables (OLTP+OLAP), Postgres (GA Feb 2026)              β”‚
β”‚  Iceberg on ADLS Gen2 = open format for Azure-first teams       β”‚
β”‚                                                                  β”‚
β”‚  SNOWFLAKE vs DATABRICKS:                                        β”‚
β”‚  Snowflake = SQL warehouse, BI, sharing, minimal code           β”‚
β”‚  Databricks = ETL/ELT, Python, ML, streaming, open formats     β”‚
β”‚  BOTH TOGETHER: Databricks (ETL) β†’ Snowflake (analytics/BI)    β”‚
β”‚                                                                  β”‚
β”‚  FRAME WITH TRAVEL DOMAIN:                                       β”‚
β”‚  "At enterprise scale with 10B bookings/year, many airlines..." β”‚
β”‚  "For GDPR with passenger PII across 100+ countries..."        β”‚
β”‚  "For real-time fare pricing with seconds-scale latency..."        β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Advanced

Snowflake Scenarios, Labs, and Production Traps

#

Snowflake Scenarios, Labs, and Production Traps

Answer First: Use each scenario as an evidence-led drill: state the workload contract, inspect Snowflake telemetry, change one control, and verify latency, correctness, and cost.

Memory Map: contract -> symptom -> evidence -> hypothesis -> safe change -> verification.

Answer First: The video-free pack. Read this end-to-end and you can walk into any Snowflake interview without ever opening YouTube.

Memory Map: Snowflake β€” Confusions, Labs, Gotchas & Mock Interview -> contract -> symptom -> evidence -> hypothesis -> safe change -> verify [SF_04_Confusions_Labs_MockInterview.md:1].

Snowflake β€” Confusions, Labs, Gotchas & Mock Interview

πŸ’‘ Interview Tip
The video-free pack. Read this end-to-end and you can walk into any Snowflake interview without ever opening YouTube.

🧠 Memory Map: WAREHOUSE-STAGE-TIME

Snowflake boils down to 3 mental pillars. Remember WST:

LetterPillarWhat it controls
WWarehouse (compute)Speed + cost. Scale UP for big queries, OUT for concurrency.
SStage (data loading)How data gets IN. Internal vs External vs Named.
TTime Travel + StorageHow data is kept SAFE. Micro-partitions, zero-copy clones, fail-safe.

If you can draw these 3 pillars on a whiteboard and connect them, you understand Snowflake.

SECTION 1 β€” TOP 8 CONFUSIONS CLEARED

Answer First: Each tier = 2Γ— the previous. A 4X-Large running 1 hour = 128 credits β‰ˆ $256-$512 depending on edition.

Memory Map: Confusion #1 β€” Scale UP vs Scale OUT (Warehouse sizing vs Multi-cluster) -> slow single query -> queueing users -> size up versus clusters out -> cache cost side effect -> metric [SF_04_Confusions_Labs_MockInterview.md:23].

Confusion #1 β€” Scale UP vs Scale OUT (Warehouse sizing vs Multi-cluster)

ConceptWhat it doesWhen to use
Scale UP (resize: X-Small β†’ Small β†’ Medium β†’ Large β†’ X-Large…)Gives ONE warehouse more CPU/RAM. Each size DOUBLES credits/hour.Single slow query, heavy JOIN, big GROUP BY
Scale OUT (multi-cluster: min=1, max=10)Adds MORE warehouses of same size, running in parallel.100 users hitting dashboards at 9am (concurrency)

Credit cost (per hour):

X-Small = 1 credit/hr
Small = 2
Medium = 4
Large = 8
X-Large = 16
2X-Large = 32
3X-Large = 64
4X-Large = 128

Each tier = 2Γ— the previous. A 4X-Large running 1 hour = 128 credits β‰ˆ $256-$512 depending on edition.

Interview one-liner: "Scale UP makes one query faster. Scale OUT lets more users run queries at the same time. Queuing? Scale OUT. Slow query? Scale UP."

Answer First: Mnemonic: User, Table, Named all internal. External points to S3/Azure/GCS.

Memory Map: Confusion #2 β€” Internal Stage vs External Stage vs Named Stage vs Table Stage vs User Stage -> user/table/named stages -> internal storage or external URL -> credential ownership -> COPY path -> access boundary [SF_04_Confusions_Labs_MockInterview.md:47].

Confusion #2 β€” Internal Stage vs External Stage vs Named Stage vs Table Stage vs User Stage

Five stage types. Memorize this table:

StageStorage locationCreated byLifetimeUse case
User stage (@~)Snowflake-managedAuto (1 per user)ForeverPersonal file loads
Table stage (@%tablename)Snowflake-managedAuto (1 per table)Dropped with tableFiles tied to 1 table
Named internal stage (@my_stage)Snowflake-managedCREATE STAGE my_stageUntil droppedShared across tables
External stageS3/Azure/GCSCREATE STAGE ... URL=...Until droppedExisting data lake
(External) Directory tableS3/Azure/GCSDIRECTORY = (ENABLE=TRUE)β€”File metadata queries

Mnemonic: User, Table, Named β†’ all internal. External points to S3/Azure/GCS.

Quick example:

sql
-- External stage pointing to S3
CREATE STAGE raw_s3
  URL = 's3://my-bucket/raw/'
  STORAGE_INTEGRATION = my_s3_int
  FILE_FORMAT = (TYPE = 'CSV');

-- List files
LIST @raw_s3;

-- Load
COPY INTO orders FROM @raw_s3/orders/ PATTERN = '.*orders.*[.]csv';

Answer First: Use COPY for loading staged batches, Snowpipe for event-triggered files, external tables for query-in-place access, and Streams plus Tasks for processing table changes after ingestion.

Memory Map: Confusion #3 β€” COPY INTO vs Snowpipe vs External Tables vs Streams & Tasks -> batch files -> event files -> external table metadata -> stream/task transform -> latency owner [SF_04_Confusions_Labs_MockInterview.md:78].

Confusion #3 β€” COPY INTO vs Snowpipe vs External Tables vs Streams & Tasks

All four move data. When do I use which?

ToolTriggerLatencyUse case
COPY INTOManual / cronMinutes-HoursBulk batch load (nightly)
SnowpipeEvent (S3 notification)~1 minuteNear-real-time ingest
External TableQuery-timeβ€” (no load)Query S3 files directly (Parquet, etc.)
Streams + TasksScheduleMinutesCDC on Snowflake tables (track changes)

Memory rule: Data OUTSIDE Snowflake arriving in files β†’ Snowpipe. Data INSIDE Snowflake that changes β†’ Streams.

Interview question: "What if I need seconds-scale latency?" β†’ Snowpipe Streaming (row-by-row API, <1 second latency). If they don't ask, don't mention β€” it's newer and optional.

Answer First: Killer fact: Clone is instant because Snowflake just copies metadata pointers to the same micro-partitions. Storage grows only when the clone diverges from original.

Memory Map: Confusion #4 β€” Time Travel vs Fail-safe vs Clone -> query old version -> support-only fail-safe -> clone snapshot -> storage growth -> incident drill [SF_04_Confusions_Labs_MockInterview.md:96].

Confusion #4 β€” Time Travel vs Fail-safe vs Clone

All three are "get my data back." But they differ:

πŸ“ Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Day 0 ────── Day 1 ────── Day 90 ────── Day 97             β”‚
β”‚     β”‚           β”‚            β”‚              β”‚               β”‚
β”‚     β”‚      TIME TRAVEL  FAIL-SAFE       DATA GONE           β”‚
β”‚     β”‚      (user can     (Snowflake                         β”‚
β”‚     β”‚       query)        support only)                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
FeatureDurationYou can access?Use
Time Travel1 day (Standard) / up to 90 (Enterprise)YES β€” AT(TIMESTAMP=>...)Undo DELETE, point-in-time query
Fail-safe7 more days after Time Travel endsNO β€” contact Snowflake supportDisaster recovery
Zero-copy CloneInstant, no extra storageYESDev/test env, monthly snapshots

Code:

sql
-- Point-in-time query
SELECT * FROM orders AT(TIMESTAMP => '2026-04-01 10:00:00'::timestamp);

-- Undrop
UNDROP TABLE orders;

-- Clone a 10 TB table in 1 second (ZERO extra storage until clone is modified)
CREATE TABLE orders_dev CLONE orders;

Killer fact: Clone is instant because Snowflake just copies metadata pointers to the same micro-partitions. Storage grows only when the clone diverges from original.

Answer First: Snowflake has NO traditional partitions. But it DOES have micro-partitions.

Memory Map: Confusion #5 β€” Micro-partitions vs Clustering Keys vs Partitioning (traditional) -> automatic micro chunks -> clustering hint -> no folder partitions -> pruning evidence -> recluster caveat [SF_04_Confusions_Labs_MockInterview.md:132].

Confusion #5 β€” Micro-partitions vs Clustering Keys vs Partitioning (traditional)

Snowflake has NO traditional partitions. But it DOES have micro-partitions.

ConceptControlled bySizePurpose
Micro-partitionsSnowflake (automatic)50-500 MB compressedColumnar storage units
Clustering keyYOU (CLUSTER BY (col))β€”Controls how rows are DISTRIBUTED into micro-partitions
Traditional partitionN/Aβ€”Snowflake doesn't use these

When to set clustering key:

  • Table > 1 TB
  • Queries filter on a specific column 80%+ of the time
  • Column has HIGH cardinality (date, customer_id)
  • Natural load order DOESN'T match query order

Check clustering health:

sql
SELECT SYSTEM$CLUSTERING_INFORMATION('orders', '(order_date)');
-- Returns JSON: average_overlaps, average_depth, etc. Lower = better.

Interview one-liner: "Clustering key tells Snowflake HOW to group rows into micro-partitions. Don't set it unless the table is huge AND queries filter on one specific column."

Answer First: Warehouse left ON after hours set AUTO_SUSPEND = 60 (seconds).

Memory Map: Confusion #6 β€” Warehouse credits vs Storage cost vs Cloud services cost -> running compute consumes warehouse credits -> retained bytes accrue storage charges -> daily adjustment governs cloud-services compute [SF_04_Confusions_Labs_MockInterview.md:158].

Confusion #6 β€” Warehouse credits vs Storage cost vs Cloud services cost

Your Snowflake bill has 3 lines:

Line itemWhat's chargedHow to reduce
Compute (warehouse) creditsTime warehouse is RUNNING (per-second after first 60s)Auto-suspend, right-size, kill idle
StorageTB/month of data stored + Time Travel + Fail-safeDrop unused tables, shorten time travel
Cloud servicesQuery parsing, metadata, result cache (usually FREE up to 10% of compute)Only charged if exceeds 10% threshold

Biggest cost traps:

  1. Warehouse left ON after hours β†’ set AUTO_SUSPEND = 60 (seconds)
  2. 90-day Time Travel on huge table β†’ evaluate if 1 day is enough
  3. Too-large warehouse for tiny queries β†’ scale UP only when needed

Per-second billing rule: Min 60 seconds, then per-second. So resuming + 1 query = 60s minimum charge.

Answer First: Interview gold: If they ask "dedup keeping latest," answer with QUALIFY β€” it's 50% less code than the subquery approach.

Memory Map: Confusion #7 β€” Standard SQL vs Snowflake extensions (VARIANT, FLATTEN, QUALIFY) -> semi-structured access -> arrays to rows -> window filter shortcut -> portability tradeoff -> interview contrast [SF_04_Confusions_Labs_MockInterview.md:177].

Confusion #7 β€” Standard SQL vs Snowflake extensions (VARIANT, FLATTEN, QUALIFY)

Snowflake adds SQL features standard databases don't have:

VARIANT β€” store any JSON/semi-structured in a single column:

sql
CREATE TABLE events (id INT, payload VARIANT);
INSERT INTO events VALUES (1, PARSE_JSON('{"user":"alice","action":"click"}'));

-- Query JSON with dot notation
SELECT payload:user::STRING AS user, payload:action::STRING AS action FROM events;
-- Output:
-- user  | action
-- alice | click

FLATTEN β€” explode arrays:

sql
SELECT value FROM TABLE(FLATTEN(INPUT => PARSE_JSON('[1,2,3]')));
-- Output: 1, 2, 3 (3 rows)

QUALIFY β€” filter window functions (like HAVING but for window funcs):

sql
-- Get latest row per user (without a subquery!)
SELECT * FROM events
QUALIFY ROW_NUMBER() OVER (PARTITION BY user ORDER BY ts DESC) = 1;

Interview gold: If they ask "dedup keeping latest," answer with QUALIFY β€” it's 50% less code than the subquery approach.

Answer First: Pro tip: ALTER WAREHOUSE wh SET AUTO_SUSPEND = 60 β€” saves HUGE money for dev warehouses.

Memory Map: Confusion #8 β€” Warehouse states: SUSPENDED vs STARTED vs RESIZING -> suspended state stops cluster compute -> started state serves queued work -> resizing transitions resources while queries continue [SF_04_Confusions_Labs_MockInterview.md:210].

Confusion #8 β€” Warehouse states: SUSPENDED vs STARTED vs RESIZING

Warehouse lifecycle:

SUSPENDED ──(query arrives / RESUME)──> STARTING ──> STARTED (running)
β–² β”‚
β”‚ β”‚
└──(AUTO_SUSPEND seconds idle)β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
StateBillingNotes
SUSPENDEDZero computeMetadata still costs tiny storage
STARTINGBilledUsually < 10 seconds
STARTEDBilled per-secondRunning queries
RESIZINGOld size billed until new readyQuick (~seconds)

Pro tip: ALTER WAREHOUSE wh SET AUTO_SUSPEND = 60 β€” saves HUGE money for dev warehouses.

SECTION 2 β€” PRACTICE LABS (RUN IN SNOWSIGHT)

Answer First: What you proved: Time Travel is your undo button. No backup, no restore β€” just a SELECT with AT().

Memory Map: Lab 1: Time Travel recovery drill (10 mins) -> create damage -> AT BEFORE validate -> UNDROP or clone -> retention limit -> postmortem [SF_04_Confusions_Labs_MockInterview.md:234].

Lab 1: Time Travel recovery drill (10 mins)

Paste into Snowsight:

sql
-- Setup
CREATE OR REPLACE TABLE lab_orders (id INT, amount NUMBER, status STRING);
INSERT INTO lab_orders VALUES
  (1, 100, 'PAID'), (2, 200, 'PAID'), (3, 300, 'PENDING');

SELECT * FROM lab_orders;
-- Output:
-- 1 | 100 | PAID
-- 2 | 200 | PAID
-- 3 | 300 | PENDING

-- Capture the timestamp BEFORE disaster
SET before_disaster = (SELECT CURRENT_TIMESTAMP());

-- Disaster strikes
DELETE FROM lab_orders WHERE status = 'PAID';
SELECT * FROM lab_orders;
-- Output: only PENDING row

-- Recovery #1: query historical data
SELECT * FROM lab_orders AT(TIMESTAMP => $before_disaster);
-- Output: all 3 rows are back!

-- Recovery #2: restore fully
INSERT INTO lab_orders
SELECT * FROM lab_orders AT(TIMESTAMP => $before_disaster)
WHERE id NOT IN (SELECT id FROM lab_orders);

SELECT * FROM lab_orders ORDER BY id;
-- Output: all 3 rows restored

What you proved: Time Travel is your undo button. No backup, no restore β€” just a SELECT with AT().

Answer First: What you proved: Clone = metadata pointer. Snowflake pays storage only for what diverges.

Memory Map: Lab 2: Zero-copy clone (5 mins) -> instant metadata fork -> write divergence test -> storage bytes inspect -> drop cleanup -> dev pattern [SF_04_Confusions_Labs_MockInterview.md:275].

Lab 2: Zero-copy clone (5 mins)

sql
-- Create a large-ish table
CREATE OR REPLACE TABLE big_table AS
SELECT seq4() AS id, RANDOM() AS val
FROM TABLE(GENERATOR(ROWCOUNT => 1000000));

SELECT COUNT(*) FROM big_table;
-- Output: 1000000

-- Clone instantly
CREATE TABLE big_table_dev CLONE big_table;

-- Verify same data
SELECT COUNT(*) FROM big_table_dev;
-- Output: 1000000

-- Check storage (should show clone added 0 bytes)
SELECT TABLE_NAME, ACTIVE_BYTES
FROM INFORMATION_SCHEMA.TABLE_STORAGE_METRICS
WHERE TABLE_NAME IN ('BIG_TABLE', 'BIG_TABLE_DEV');
-- Output:
-- BIG_TABLE     | 8388608
-- BIG_TABLE_DEV | 0          ← zero bytes used, just a pointer!

-- Now modify clone β€” storage diverges
UPDATE big_table_dev SET val = 0 WHERE id < 1000;

-- Re-check storage: clone now uses some bytes

What you proved: Clone = metadata pointer. Snowflake pays storage only for what diverges.

Answer First: What you proved: Scale UP adds resources per cluster, but speedup is not guaranteed to be linear. Medium (4 credits/hr) runs ~4Γ— faster than X-Small (1 credit/hr) with workload-dependent runtime and generation-specific cost.

Memory Map: Lab 3: Warehouse sizing experiment (10 mins) -> fixed query set -> size ladder -> warm-cache control -> queue and spill metrics -> cost curve [SF_04_Confusions_Labs_MockInterview.md:311].

Lab 3: Warehouse sizing experiment (10 mins)

sql
-- Create test data
CREATE OR REPLACE TABLE big_sales AS
SELECT
  seq4() AS sale_id,
  UNIFORM(1, 10000, RANDOM()) AS customer_id,
  UNIFORM(1, 100, RANDOM()) * 10 AS amount,
  DATEADD(DAY, UNIFORM(-365, 0, RANDOM()), CURRENT_DATE()) AS sale_date
FROM TABLE(GENERATOR(ROWCOUNT => 100000000));  -- 100 million rows

-- Test on X-Small warehouse
ALTER WAREHOUSE compute_wh SET WAREHOUSE_SIZE = 'XSMALL';
SELECT customer_id, SUM(amount) FROM big_sales GROUP BY customer_id ORDER BY 2 DESC LIMIT 10;
-- Note query time in Snowsight history tab

-- Scale UP and re-run
ALTER WAREHOUSE compute_wh SET WAREHOUSE_SIZE = 'MEDIUM';
SELECT customer_id, SUM(amount) FROM big_sales GROUP BY customer_id ORDER BY 2 DESC LIMIT 10;
-- Compare times

-- Clean up (important! bigger warehouse costs more)
ALTER WAREHOUSE compute_wh SET WAREHOUSE_SIZE = 'XSMALL';

What you proved: Scale UP adds resources per cluster, but speedup is not guaranteed to be linear. Medium (4 credits/hr) runs ~4Γ— faster than X-Small (1 credit/hr) β†’ with workload-dependent runtime and generation-specific cost.

SECTION 3 β€” LIVE VISUAL ANIMATIONS (whiteboard these)

Answer First: SQL arrives at Cloud Services parse, optimize, check cache.

Memory Map: Animation 1: How a query flows through Snowflake's 3-layer architecture -> cloud services compile -> result reuse check -> warehouse execution -> storage scan -> profile trace [SF_04_Confusions_Labs_MockInterview.md:343].

Animation 1: How a query flows through Snowflake's 3-layer architecture

πŸ“ Architecture Diagram
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LAYER 3: Cloud Services (brain)                    β”‚
β”‚  β€’ Parser, optimizer, metadata, security            β”‚
β”‚  β€’ Cached results live here                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LAYER 2: Compute (virtual warehouses)              β”‚
β”‚  β€’ X-Small, Small, Medium … 6X-Large                β”‚
β”‚  β€’ Multiple warehouses share data layer             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LAYER 1: Storage (S3/Azure Blob/GCS)               β”‚
β”‚  β€’ Micro-partitions, columnar, compressed           β”‚
β”‚  β€’ ALL warehouses read from same storage            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Query lifecycle:

  1. SQL arrives at Cloud Services β†’ parse, optimize, check cache
  2. If cached β†’ return instantly (0 credits)
  3. If not β†’ Compute warehouse scans needed micro-partitions in Storage
  4. Results sent back, cached in Cloud Services for 24h

Why this matters: Compute and storage scale INDEPENDENTLY. You can have 10 warehouses all reading the same table. No data copy.

Answer First: Takeaway: No index needed. Min/max metadata on each micro-partition = automatic pruning.

Memory Map: Animation 2: Micro-partition pruning in action -> min/max metadata -> predicate range check -> skipped partitions -> scanned bytes -> filter design [SF_04_Confusions_Labs_MockInterview.md:377].

Animation 2: Micro-partition pruning in action

Table orders with 1 billion rows, pruned by WHERE order_date = '2026-04-01':

πŸ“ Architecture Diagram
Table = 1000 micro-partitions
Each stores its MIN/MAX order_date

β”Œβ”€β”€MP1──┐  β”Œβ”€β”€MP2──┐  β”Œβ”€β”€MP3──┐  β”Œβ”€β”€MP4──┐  ...  β”Œβ”€β”€MP1000─┐
β”‚min:1/1β”‚  β”‚min:1/5β”‚  β”‚min:2/1β”‚  β”‚min:4/1β”‚       β”‚min:12/25β”‚
β”‚max:1/5β”‚  β”‚max:2/1β”‚  β”‚max:4/1β”‚  β”‚max:5/1β”‚       β”‚max:12/31β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   SKIP        SKIP       SKIP     βœ“READ            SKIP

Query: WHERE order_date = '2026-04-01'
Scan:  1 out of 1000 partitions = 0.1% of data read

Takeaway: No index needed. Min/max metadata on each micro-partition = automatic pruning.

Answer First: Gotcha: Warehouse cache disappears when you suspend. Frequently-queried dashboards keep warehouse warm OR rely on result cache.

Memory Map: Animation 3: The 3-tier cache hierarchy -> persisted result -> local SSD blocks -> remote storage services -> invalidation branches -> cost impact [SF_04_Confusions_Labs_MockInterview.md:399].

Animation 3: The 3-tier cache hierarchy

πŸ“ Architecture Diagram
Query arrives
     β”‚
     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TIER 1: Result Cache        β”‚ ← 24hr, FREE, 0 credits
β”‚ (Cloud Services layer)      β”‚   If same query + same data β†’ return cached
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ miss
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TIER 2: Warehouse Cache     β”‚ ← Lives on warehouse SSD
β”‚ (Virtual Warehouse)         β”‚   Lost when warehouse suspends!
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ miss
           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ TIER 3: Remote Storage      β”‚ ← S3/Azure/GCS β€” slowest
β”‚ (Blob storage)              β”‚   Always the ground truth
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Gotcha: Warehouse cache disappears when you suspend. Frequently-queried dashboards β†’ keep warehouse warm OR rely on result cache.

SECTION 4 β€” GOTCHAS (REAL PRODUCTION FAILURES)

Answer First: Fix: Don't embed CURRENT_TIMESTAMP, RANDOM(), CURRENT_USER() in dashboards unless you want uncached runs.

Memory Map: Gotcha 1: Result cache silently lies if clock-sensitive functions are used -> nondeterministic functions -> session context differences -> mutation invalidates -> bypass reason -> history test [SF_04_Confusions_Labs_MockInterview.md:429].

Gotcha 1: Result cache silently lies if clock-sensitive functions are used

sql
SELECT CURRENT_TIMESTAMP(), COUNT(*) FROM orders;
-- This query NEVER hits result cache (timestamp is non-deterministic)

Fix: Don't embed CURRENT_TIMESTAMP, RANDOM(), CURRENT_USER() in dashboards unless you want uncached runs.

Answer First: AUTO_SUSPEND = 0 disables automatic suspension, so an otherwise idle warehouse can continue consuming credits until it is suspended explicitly.

Memory Map: Gotcha 2: AUTO_SUSPEND = 0 means NEVER suspend -> zero disables idle shutdown -> started warehouse keeps consuming credits -> positive timeout restores automatic suspension [SF_04_Confusions_Labs_MockInterview.md:438].

Gotcha 2: AUTO_SUSPEND = 0 means NEVER suspend

sql
-- Wrong (runs forever, burns credits)
ALTER WAREHOUSE wh SET AUTO_SUSPEND = 0;

-- Right
ALTER WAREHOUSE wh SET AUTO_SUSPEND = 60;  -- 60 seconds idle

AUTO_SUSPEND = 0 disables automatic suspension, so an otherwise idle warehouse can continue consuming credits until it is suspended explicitly.

Answer First: A task or stored procedure might run under a DIFFERENT role than your session. Always set role/warehouse explicitly inside procedures.

Memory Map: Gotcha 3: USE ROLE / USE WAREHOUSE is session-scoped -> session context selects authorization and compute -> reconnect resets configured defaults -> explicit context prevents accidental execution [SF_04_Confusions_Labs_MockInterview.md:450].

Gotcha 3: USE ROLE / USE WAREHOUSE is session-scoped

A task or stored procedure might run under a DIFFERENT role than your session. Always set role/warehouse explicitly inside procedures.

sql
CREATE TASK nightly_load
  WAREHOUSE = etl_wh   -- explicit
  SCHEDULE = 'USING CRON 0 2 * * * UTC'
AS
  CALL load_orders();

Answer First: Fix to force reload: COPY INTO ... FORCE = TRUE OR purge the load metadata.

Memory Map: Gotcha 4: COPY INTO silently skips files already loaded -> recent load history -> filename checksum metadata -> FORCE bypass -> duplicate prevention -> replay ledger [SF_04_Confusions_Labs_MockInterview.md:462].

Gotcha 4: COPY INTO silently skips files already loaded

sql
COPY INTO orders FROM @stage;  -- loads file1.csv
COPY INTO orders FROM @stage;  -- SKIPS file1.csv (already loaded per LOAD_HISTORY)

Fix to force reload: COPY INTO ... FORCE = TRUE OR purge the load metadata.

Answer First: SQL NULL and JSON null are distinct inside VARIANT; test JSON null with IS_NULL_VALUE or compare against PARSE_JSON('null') instead of IS NULL alone.

Memory Map: Gotcha 5: VARIANT column NULL vs JSON null -> SQL NULL versus JSON null -> IS_NULL_VALUE check -> cast behavior -> data quality rule -> test fixture [SF_04_Confusions_Labs_MockInterview.md:471].

Gotcha 5: VARIANT column NULL vs JSON null

sql
SELECT
  PARSE_JSON('null') IS NULL,          -- Output: FALSE (it's a JSON null, not SQL NULL)
  PARSE_JSON('null')::STRING;          -- Output: 'null' (the string "null")

Fix: Compare with PARSE_JSON('null') or use IS_NULL_VALUE(col).

Answer First: If credits are huge, clustering key may be wrong choice.

Memory Map: Gotcha 6: Clustering keys DON'T auto-maintain without auto-clustering service -> key declaration -> service enabled check -> depth monitor -> maintenance credits -> benefit proof [SF_04_Confusions_Labs_MockInterview.md:481].

Gotcha 6: Clustering keys DON'T auto-maintain without auto-clustering service

Once you ALTER TABLE t CLUSTER BY (col), Snowflake runs automatic background reclustering (costs credits). Monitor:

sql
SELECT * FROM TABLE(INFORMATION_SCHEMA.AUTOMATIC_CLUSTERING_HISTORY(
  DATE_RANGE_START => DATEADD(DAY, -7, CURRENT_DATE())
));

If credits are huge, clustering key may be wrong choice.

SECTION 5 β€” TIMED MOCK INTERVIEW (45 MIN)

Answer First: External stage pointing to S3 + storage integration for secure access.

Memory Map: Q1 (8 min) β€” "Design an ingestion pipeline: S3 CSVs land every 5 minutes, need them queryable ASAP" -> landing notification -> Snowpipe for files -> Streaming for rows -> Dynamic Table silver -> SLA monitor [SF_04_Confusions_Labs_MockInterview.md:494].

Q1 (8 min) β€” "Design an ingestion pipeline: S3 CSVs land every 5 minutes, need them queryable ASAP"

Strong answer structure:

  1. External stage pointing to S3 + storage integration for secure access
  2. Snowpipe with auto-ingest (S3 event notification β†’ SQS β†’ Snowpipe)
  3. Target table with appropriate clustering key (event_date)
  4. Stream on target for downstream CDC
  5. Task reading the stream every 5 min to populate dimension/fact tables

Key decisions to mention: Error handling (ON_ERROR = 'CONTINUE' vs 'ABORT_STATEMENT'), file format (compressed Parquet > CSV for cost), warehouse sizing for Snowpipe (it uses serverless compute by default, not your warehouse).

Answer First: Check Query Profile in Snowsight history β€” find longest step.

Memory Map: Q2 (6 min) β€” "A query that used to take 30 seconds now takes 5 minutes. How do you debug?" -> history baseline -> profile operator -> pruning/spill/skew -> one-change experiment -> rollback [SF_04_Confusions_Labs_MockInterview.md:507].

Q2 (6 min) β€” "A query that used to take 30 seconds now takes 5 minutes. How do you debug?"

Checklist:

  1. Check Query Profile in Snowsight history β€” find longest step
  2. Is "Bytes scanned" huge? β†’ clustering key degraded, missing partition pruning
  3. Is "Spilling to local/remote disk" shown? β†’ warehouse too small, scale up
  4. Check warehouse load β€” was it queuing? (other users competing)
  5. Compare with a baseline: SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY WHERE query_hash = ...
  6. Data volume growth? Table may need reclustering or larger warehouse

Answer First: Likely culprits: warehouse not auto-suspending, someone ran a SELECT * on 10 TB, Time Travel retention extended, new pipeline spun up.

Memory Map: Q3 (5 min) β€” "Your boss says the Snowflake bill doubled last month. Find the cause." -> usage history separates compute storage and services -> tags attribute owners and workloads -> runtime or retention change explains variance [SF_04_Confusions_Labs_MockInterview.md:519].

Q3 (5 min) β€” "Your boss says the Snowflake bill doubled last month. Find the cause."

sql
-- Which warehouses are burning credits?
SELECT warehouse_name, SUM(credits_used) AS credits
FROM SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY
WHERE start_time >= DATEADD(DAY, -30, CURRENT_DATE())
GROUP BY 1 ORDER BY 2 DESC;

-- Which users are running most?
SELECT user_name, COUNT(*) AS queries, SUM(execution_time)/1000/60 AS minutes
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE start_time >= DATEADD(DAY, -30, CURRENT_DATE())
GROUP BY 1 ORDER BY 3 DESC;

-- Storage growth
SELECT DATE_TRUNC('DAY', usage_date) AS day, AVG(storage_bytes)/POWER(1024,4) AS tb
FROM SNOWFLAKE.ACCOUNT_USAGE.STORAGE_USAGE
WHERE usage_date >= DATEADD(DAY, -60, CURRENT_DATE())
GROUP BY 1 ORDER BY 1;

Likely culprits: warehouse not auto-suspending, someone ran a SELECT * on 10 TB, Time Travel retention extended, new pipeline spun up.

Answer First: A zero-copy clone starts as metadata over shared micro-partitions, but divergent writes add storage, Time Travel accrues independently, grants need review, and load history is not cloned.

Memory Map: Q4 (4 min) β€” "Zero-copy clone for dev env β€” what's the catch?" -> shared base data -> changes add storage -> grants and retention -> stale dev risk -> cleanup owner [SF_04_Confusions_Labs_MockInterview.md:545].

Q4 (4 min) β€” "Zero-copy clone for dev env β€” what's the catch?"

Catch:

  • Clone is instant + free at creation
  • Modifying clone diverges β†’ storage starts counting
  • Time Travel on clone is independent (starts at clone creation)
  • Clone does NOT inherit grants/permissions automatically β†’ re-grant
  • Clones don't clone LOAD_HISTORY β†’ COPY INTO on clone may re-load files

Answer First: Use a materialized view when an eligible expensive single-table query repeats enough to outweigh automatic refresh and storage cost; verify benefit and maintenance overhead together.

Memory Map: Q5 (4 min) β€” "When do you use a Materialized View?" -> stable repeated query -> supported SQL check -> maintenance credit estimate -> compare search/clustering -> win metric [SF_04_Confusions_Labs_MockInterview.md:556].

Q5 (4 min) β€” "When do you use a Materialized View?"

  • Query is SLOW and re-run often
  • Base table has HIGH data volume, LOW query selectivity
  • Costs: MV itself uses storage + auto-refresh consumes credits

Don't use when: base table changes constantly (refresh cost > savings), query joins many tables (MVs can't span joins in Snowflake β€” limited to single table aggregations/projections).

SECTION 6 β€” FINAL READINESS CHECKLIST

Before your Snowflake interview, be ready to answer YES to all of these:

  • Can I draw the 3-layer architecture (Cloud Services / Compute / Storage) and explain independence?
  • Do I know the 4 warehouse-sizing rules (UP for slow query, OUT for concurrency, AUTO_SUSPEND, per-sec billing)?
  • Can I explain micro-partition pruning without saying "index"?
  • Do I know Time Travel vs Fail-safe vs Clone?
  • Can I write COPY INTO, Snowpipe definition, and Stream+Task from memory?
  • Can I use QUALIFY and VARIANT/FLATTEN fluently?
  • Do I know the 3 cache tiers and why warehouse cache dies on suspend?
  • Can I debug a slow query using Query Profile (bytes scanned + spilling)?
  • Can I list 3 ways to reduce a Snowflake bill?
  • Can I explain when clustering key is worth its cost?

If all 10 = YES, you're interview-ready. Re-read this page the morning of the interview.

Remember WAREHOUSE-STAGE-TIME. Everything else is details.

Advanced

Snowflake Interview Question Index

#

Snowflake Interview Question Index

This module intentionally contains links rather than duplicate answers. Practice the source wording, then open the exact rendered concept owner for the direct answer, mechanism, examples, caveats, and verification evidence.

Q-SF-001: What is Snowflake? Explain its architecture.

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L15.

Q-SF-002: What are Micro-Partitions? How are they different from Hive partitions?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L79.

Q-SF-003: What are Clustering Keys? When should you use them?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L142.

Q-SF-004: What is a Virtual Warehouse? Explain sizing and multi-cluster.

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L192.

Q-SF-005: Explain the 3 levels of Caching in Snowflake.

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L255.

Q-SF-006: What is Time Travel? What is Fail-safe?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L319.

Q-SF-007: What is Zero-Copy Cloning?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L385.

Q-SF-008: What is VARIANT? How does Snowflake handle semi-structured data?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L420.

Q-SF-009: What are Stages? Internal vs External?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L493.

Q-SF-010: [DIRECT] Common Basic Questions

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L549.

Q-SF-011: Snowflake vs Databricks β€” When to use which?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L570.

Q-SF-012: Scenario β€” Design a Snowflake architecture for a travel platform's booking analytics

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L635.

Q-SF-013: Scenario β€” Why is a specific query slow? How to diagnose?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Architecture_Core.md#L678.

Q-SF-014: What is Snowflake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L87.

Q-SF-015: What are the 3 layers of Snowflake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L90.

Q-SF-016: What makes Snowflake different from traditional databases?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L95.

Q-SF-017: What are micro-partitions?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L98.

Q-SF-018: Are Snowflake micro-partitions the same as Hive partitions?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L101.

Q-SF-019: What is a clustering key?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L104.

Q-SF-020: What is partition pruning?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L107.

Q-SF-021: What is a Virtual Warehouse?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L110.

Q-SF-022: What is a multi-cluster warehouse?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L113.

Q-SF-023: Scale UP vs Scale OUT β€” what's the difference?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L116.

Q-SF-024: How does Snowflake read a query? (End-to-end flow)

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L124.

Q-SF-025: What happens when warehouse is auto-suspended?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L133.

Q-SF-026: How to decide virtual warehouse size?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L136.

Q-SF-027: Explain clustering depth and overlap

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L139.

Q-SF-028: What are the 3 caching levels in Snowflake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L179.

Q-SF-029: When is Result Cache used?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L184.

Q-SF-030: Why might Result Cache NOT be used even for the same query?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L187.

Q-SF-031: What happens to cache when warehouse is suspended?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L193.

Q-SF-032: What is Time Travel?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L230.

Q-SF-033: What is the default time travel period?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L233.

Q-SF-034: What is the difference between Time Travel and Fail-safe?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L236.

Q-SF-035: What is Zero-Copy Cloning?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L240.

Q-SF-036: What are the use cases for Zero-Copy Clone?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L243.

Q-SF-037: What is the VARIANT data type?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L278.

Q-SF-038: How do you access a JSON field from a VARIANT column?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L281.

Q-SF-039: What is FLATTEN?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L284.

Q-SF-040: Why must you cast VARIANT values?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_01_Quick_Recall.md#L287.

Q-SF-041: What is COPY INTO? How is it different from INSERT?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L11.

Q-SF-042: What is Snowpipe? How does it differ from COPY INTO?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L69.

Q-SF-043: What Are Snowflake Streams? How Do They Enable CDC?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L142.

Q-SF-044: What Are Snowflake Tasks? How Do You Schedule SQL?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L280.

Q-SF-045: What Are Dynamic Tables? How Are They Different from Streams + Tasks?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L461.

Q-SF-046: Q5b: Explain Materialized Views in Snowflake

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L568.

Q-SF-047: What is Snowpark? When is it useful?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L655.

Q-SF-048: How do you optimize query performance in Snowflake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L729.

Q-SF-049: Scenario β€” Dashboard queries are slow for 200 BI analysts. How to fix?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Pipelines_Performance.md#L799.

Q-SF-050: What is COPY INTO?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L53.

Q-SF-051: What is a Stage?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L56.

Q-SF-052: What is Snowpipe?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L59.

Q-SF-053: What is Snowpipe Streaming?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L62.

Q-SF-054: COPY INTO vs Snowpipe vs Snowpipe Streaming β€” when to use which?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L65.

Q-SF-055: Is COPY INTO safe to re-run?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L73.

Q-SF-056: What happens with bad rows in COPY INTO?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L76.

Q-SF-057: What is a Stream?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L123.

Q-SF-058: What are the 3 metadata columns in a Stream?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L126.

Q-SF-059: How does an UPDATE appear in a Standard Stream?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L129.

Q-SF-060: What is an Append-Only Stream?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L132.

Q-SF-061: When does a Stream "advance"?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L135.

Q-SF-062: What is a Task?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L173.

Q-SF-063: How do you chain Tasks into a pipeline?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L176.

Q-SF-064: What is the difference between warehouse-based and serverless tasks?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L179.

Q-SF-065: How do you monitor task failures?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L184.

Q-SF-066: What is a Dynamic Table?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L228.

Q-SF-067: What is TARGET_LAG?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L231.

Q-SF-068: Dynamic Tables vs Streams + Tasks β€” when to use which?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L234.

Q-SF-069: What is INCREMENTAL refresh vs FULL refresh?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L238.

Q-SF-070: How does a Dynamic Table handle an UPDATE in source?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L242.

Q-SF-071: What is Query Profile?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L286.

Q-SF-072: What does "spilling to disk" mean?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L289.

Q-SF-073: What is a Materialized View?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L292.

Q-SF-074: What is Search Optimization Service?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L295.

Q-SF-075: Clustering key vs Search Optimization β€” when to use which?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_02_Quick_Recall.md#L298.

Q-SF-076: What is RBAC in Snowflake? What are the system roles?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L11.

Q-SF-077: What is Data Masking? How does it work?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L90.

Q-SF-078: What are Row Access Policies?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L137.

Q-SF-079: What is Secure Data Sharing? How does it work?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L184.

Q-SF-080: How do you manage and optimize Snowflake costs?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L233.

Q-SF-081: What are the major Snowflake features from 2025-2026?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L314.

Q-SF-082: 10 Most-Likely Snowflake Interview Questions

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Security_Sharing_New.md#L472.

Q-SF-083: What is RBAC in Snowflake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L71.

Q-SF-084: What are the 5 system-defined roles?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L74.

Q-SF-085: What does each system role do?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L77.

Q-SF-086: What is the #1 RBAC mistake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L84.

Q-SF-087: What is FUTURE GRANTS?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L87.

Q-SF-088: How do you switch roles?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L90.

Q-SF-089: Design a role hierarchy for 200 engineers at a large enterprise

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L97.

Q-SF-090: What is Dynamic Data Masking?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L156.

Q-SF-091: What is a Row Access Policy?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L159.

Q-SF-092: Column masking vs Row Access β€” what's the difference?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L162.

Q-SF-093: How does CURRENT_ROLE() work in policies?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L166.

Q-SF-094: What is Secure Data Sharing?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L202.

Q-SF-095: What is a Reader Account?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L205.

Q-SF-096: What is a Data Clean Room?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L208.

Q-SF-097: Who pays for what in Data Sharing?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L211.

Q-SF-098: What is a Resource Monitor?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L220.

Q-SF-099: What is a Transient Table?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L223.

Q-SF-100: What is the biggest Snowflake cost mistake?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L226.

Q-SF-101: How do you optimize storage cost?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L229.

Q-SF-102: What are Gen 2 Warehouses?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L275.

Q-SF-103: What is Cortex AI?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L278.

Q-SF-104: What is Cortex Search? What's new in 2026?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L281.

Q-SF-105: What are Iceberg Tables?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L284.

Q-SF-106: What is Polaris Open Catalog?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L287.

Q-SF-107: What are Hybrid Tables?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L290.

Q-SF-108: What is Snowflake Postgres?

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_03_Quick_Recall.md#L293.

Q-SF-109: Confusion #1 β€” Scale UP vs Scale OUT (Warehouse sizing vs Multi-cluster)

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L23.

Q-SF-110: Confusion #2 β€” Internal Stage vs External Stage vs Named Stage vs Table Stage vs User Stage

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L47.

Q-SF-111: Confusion #3 β€” COPY INTO vs Snowpipe vs External Tables vs Streams & Tasks

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L78.

Q-SF-112: Confusion #4 β€” Time Travel vs Fail-safe vs Clone

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L96.

Q-SF-113: Confusion #5 β€” Micro-partitions vs Clustering Keys vs Partitioning (traditional)

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L132.

Q-SF-114: Confusion #6 β€” Warehouse credits vs Storage cost vs Cloud services cost

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L158.

Q-SF-115: Confusion #7 β€” Standard SQL vs Snowflake extensions (VARIANT, FLATTEN, QUALIFY)

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L177.

Q-SF-116: Confusion #8 β€” Warehouse states: SUSPENDED vs STARTED vs RESIZING

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L210.

Q-SF-117: Q1 (8 min) β€” "Design an ingestion pipeline: S3 CSVs land every 5 minutes, need them queryable ASAP"

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L494.

Q-SF-118: Q2 (6 min) β€” "A query that used to take 30 seconds now takes 5 minutes. How do you debug?"

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L507.

Q-SF-119: Q3 (5 min) β€” "Your boss says the Snowflake bill doubled last month. Find the cause."

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L519.

Q-SF-120: Q4 (4 min) β€” "Zero-copy clone for dev env β€” what's the catch?"

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L545.

Q-SF-121: Q5 (4 min) β€” "When do you use a Materialized View?"

Answer owner: Open the canonical concept or runnable pattern.

Alternate source wording: content/snowflake/SF_04_Confusions_Labs_MockInterview.md#L556.

90 seconds

Practice sprint

Close the atlas. Rebuild the map.

Name the path from API to files, then explain where shuffle, skew, and serialization enter the system.

Open interview prompts