๐ŸŽ‰ 75% of content is free forever โ€” Unlock Premium from $10/mo โ†’
CW
NEWSLIVESearch All Content
๐Ÿ’ผ Servicesโ„น๏ธ Aboutโœ‰๏ธ ContactView Pricing Plansfrom $10

Topic: Data Lakehouse, External Tables & Iceberg

Snowflake AdvancedData Lakehouseโญ Premium

Snowflake Advanced ยท Interview Prep

Data Lakehouse, External Tables & Iceberg

Difficulty: Hard ยท Commonly asked at Netflix, Uber, Google

Interview Question

"How would you architect a hybrid data lakehouse using Snowflake and S3? Discuss external tables, Iceberg tables, and the trade-offs between Snowflake-native tables and open table formats."

โ„น๏ธ

Companies Asking This: Netflix (Staff Data Engineer), Uber (Senior Data Engineer), Google (Cloud Data Architect), Amazon (L6 Data Engineer)


Data Lakehouse Architecture

A lakehouse is a cost decision wearing an architecture label. The storage layer holds the bytes โ€” S3, Azure Blob, GCS, or an HDFS mount โ€” and the Snowflake layer decides how much structure Snowflake materializes locally: everything in native tables where query speed matters, nothing where bytes should stay put, or Iceberg when several engines must share the same tables. The presentation layer above never learns which choice each table made, and that is the point: BI, notebooks, and ML jobs keep one SQL surface while storage cost and latency are tuned per table. The framing that lands in an interview is percentages rather than adjectives โ€” which share of the estate is hot, warm, and cold, what each tier costs per month, and what a tier move saves, before drawing a single box. One boundary to draw early: a view can span tiers with UNION ALL, but SLAs do not unify with it โ€” the cold leg usually dominates elapsed time, so expose the tier as a column, exactly as the hybrid script later does, and let dashboards show users which leg they waited on.

Presentation LayerBI ToolsNotebooksML ToolsAppsSnowflake LayerNative TablesExternal TablesIceberg TablesStorage LayerS3(Data Lake)Azure BlobStorageGCSHDFS

External Tables

External tables query data directly from cloud storage without loading it into Snowflake.

They work by storing metadata and column definitions in Snowflake while the files remain the source of truth, so every query pays file-listing and read costs at run time instead of paying to store the bytes twice. Three properties decide where they fit. They are read-only โ€” no UPDATE, no DELETE, no TRUNCATE against the table itself, because the data layer is not yours to mutate from here; producers rewrite files or you copy into a native table that owns its own storage. AUTO_REFRESH wires notification integrations to the stage so new files become visible without polling, and refresh history in the information schema shows exactly what each scan observed. And performance trails native tables by a real margin, since each query re-reads and re-parses files with no micro-partition caching to lean on โ€” the trade you accept to avoid an ingestion pipeline for data that gets read twice a week. The honest cost metric is bytes scanned per query in query history: external tables do not bill separately, but the warehouse seconds the scan consumes are the lake leg's true price.

Creating External Tables

-- 1. Create storage integration
CREATE OR REPLACE STORAGE INTEGRATION s3_lake_int
    TYPE = EXTERNAL_STAGE
    ENABLED = TRUE
    STORAGE_PROVIDER = S3
    STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::123456789:role/snowflake-role'
    STORAGE_ALLOWED_LOCATIONS = ('s3://data-lake/raw/');

-- 2. Create external stage
CREATE OR REPLACE STAGE lake_stage
    URL = 's3://data-lake/raw/'
    STORAGE_INTEGRATION = s3_lake_int;

-- 3. Create external table (JSON)
CREATE OR REPLACE EXTERNAL TABLE raw_events_ext (
    event_id VARCHAR(100) AS ($1:event_id::VARCHAR),
    event_type VARCHAR(50) AS ($1:event_type::VARCHAR),
    event_timestamp TIMESTAMP_NTZ AS ($1:timestamp::TIMESTAMP_NTZ),
    user_id VARCHAR(100) AS ($1:user_id::VARCHAR),
    payload VARIANT AS ($1)
)
LOCATION = @lake_stage
FILE_FORMAT = (TYPE = 'JSON' STRIP_OUTER_ARRAY = TRUE)
AUTO_REFRESH = TRUE
REFRESH_ON_CREATE = TRUE;

-- 4. Create external table (Parquet)
CREATE OR REPLACE EXTERNAL TABLE raw_orders_ext (
    order_id VARCHAR(100) AS ($1:order_id::VARCHAR),
    customer_id VARCHAR(100) AS ($1:customer_id::VARCHAR),
    order_date DATE AS ($1:order_date::DATE),
    amount NUMBER(12,2) AS ($1:amount::NUMBER),
    status VARCHAR(20) AS ($1:status::VARCHAR)
)
LOCATION = @lake_stage/orders/
FILE_FORMAT = (TYPE = 'PARQUET')
AUTO_REFRESH = TRUE;

-- 5. Query external tables
SELECT 
    event_type,
    COUNT(*) AS event_count,
    MIN(event_timestamp) AS earliest,
    MAX(event_timestamp) AS latest
FROM raw_events_ext
WHERE event_timestamp >= DATEADD(day, -7, CURRENT_DATE())
GROUP BY 1;

-- 6. Monitor external table refresh
SELECT 
    table_name,
    refresh_time,
    state,
    bytes_scanned,
    files_added,
    files_removed
FROM information_schema.external_table_refresh_history
WHERE table_name = 'RAW_EVENTS_EXT'
ORDER BY refresh_time DESC;

Iceberg Tables

Snowflake supports Apache Iceberg, an open table format for large analytic datasets.

Iceberg flips who owns the table format: metadata and data files live in your object store under an open specification, and Snowflake becomes one engine among several that can read them. Snapshots deliver time travel without Snowflake-specific retention plumbing, partition transforms prune reads without the query ever naming the partition column, and the partition spec itself can evolve without rewriting history. The catalog choice is the real fork in the road โ€” Snowflake's own catalog keeps DDL and maintenance inside one platform, while a catalog integration lets Spark or Trino read the same files without routing through you. Inside Snowflake, Iceberg tables take full DML like native tables; outside, the format's own maintenance โ€” snapshot expiration, small-file cleanup โ€” has to be scheduled by someone, and skipping it is how an open table becomes a slow one. There is also a portability angle worth a sentence in the interview: because the bytes never leave your bucket, adding a second engine is a catalog registration rather than a migration project.

Creating Iceberg Tables

-- 1. Create Iceberg table backed by S3
CREATE OR REPLACE EXTERNAL TABLE orders_iceberg
    CATALOG = 'SNOWFLAKE_CATALOG'
    EXTERNAL_VOLUME = 's3_iceberg_volume'
    TABLE_FORMAT = 'ICEBERG'
    DATA_FILES_LOCATION = 's3://data-lake/iceberg/orders/'
    AS
SELECT 
    order_id,
    customer_id,
    order_date,
    amount,
    status
FROM orders;

-- 2. Create Iceberg table from existing data
CREATE OR REPLACE ICEBERG TABLE orders_iceberg
    CATALOG = 'SNOWFLAKE_CATALOG'
    EXTERNAL_VOLUME = 's3_iceberg_volume'
    BASE_LOCATION = 's3://data-lake/iceberg/orders/'
    AS
SELECT * FROM orders;

-- 3. Query Iceberg table
SELECT 
    order_date,
    COUNT(*) AS order_count,
    SUM(amount) AS total_revenue
FROM orders_iceberg
WHERE order_date >= '2024-01-01'
GROUP BY 1
ORDER BY 1;

-- 4. Time travel on Iceberg tables
SELECT * FROM orders_iceberg
    AT (TIMESTAMP => '2024-01-15 10:00:00'::TIMESTAMP_NTZ);

-- 5. Schema evolution on Iceberg tables
ALTER TABLE orders_iceberg ADD COLUMN shipping_address VARCHAR(500);
ALTER TABLE orders_iceberg RENAME COLUMN amount TO total_amount;

Real-World Scenario: Netflix

Question: "How do you manage a data lake with 50PB of data using Snowflake? Discuss the hybrid approach using external tables and native tables."

Tiering only pays when the access distribution is genuinely skewed, so answer with numbers: in a 50 PB estate where roughly 90 percent of queries touch the newest 90 days, keeping that hot slice native and leaving everything older in the bucket can cut the storage bill by more than half compared with copying the full estate into Snowflake-native storage. The mechanics below move rows between tiers on a schedule, but the governance question underneath is whether the retention labels are honest โ€” a cold tier that the data-science team still queries nightly is native data wearing a costume, and the only way to know is bytes-scanned telemetry per table, not a policy document. Pair the lifecycle procedure with alerting on the tier-move task, because a failed COPY INTO that nobody notices leaves the hot table growing for a month while the bill quietly compounds.

Solution: Hybrid Lakehouse Strategy

-- 1. Tiered storage strategy
-- Hot data: Snowflake native tables (frequently queried)
CREATE TABLE events_hot CLUSTER BY (event_date, event_type)
AS SELECT * FROM events WHERE event_date >= DATEADD(day, -90, CURRENT_DATE());

-- Warm data: External tables (infrequently queried)
CREATE EXTERNAL TABLE events_warm (
    event_id VARCHAR(100) AS ($1:event_id::VARCHAR),
    event_date DATE AS ($1:event_date::DATE),
    event_type VARCHAR(50) AS ($1:event_type::VARCHAR),
    payload VARIANT AS ($1)
)
LOCATION = @lake_stage/events/warm/
FILE_FORMAT = (TYPE = 'PARQUET');

-- Cold data: Iceberg tables (archival)
CREATE OR REPLACE ICEBERG TABLE events_cold
    CATALOG = 'SNOWFLAKE_CATALOG'
    EXTERNAL_VOLUME = 's3_cold_volume'
    BASE_LOCATION = 's3://data-lake/archive/events/'
    AS
SELECT * FROM events WHERE event_date < DATEADD(year, -1, CURRENT_DATE());

-- 2. Data lifecycle management
CREATE OR REPLACE PROCEDURE manage_data_lifecycle()
RETURNS VARCHAR
LANGUAGE SQL
AS
$$
DECLARE
    moved_count NUMBER;
BEGIN
    -- Move data from hot to warm (90+ days old)
    CREATE OR REPLACE TEMPORARY TABLE events_to_warm AS
    SELECT * FROM events_hot
    WHERE event_date < DATEADD(day, -90, CURRENT_DATE());
    
    -- Insert into external stage
    COPY INTO @lake_stage/events/warm/
    FROM events_to_warm
    FILE_FORMAT = (TYPE = 'PARQUET')
    HEADER = TRUE;
    
    -- Delete from hot
    DELETE FROM events_hot
    WHERE event_date < DATEADD(day, -90, CURRENT_DATE());
    
    moved_count := SQLROWCOUNT;
    
    RETURN 'Moved ' || moved_count || ' records from hot to warm';
END;
$$;

-- 3. Unified query across tiers
CREATE OR REPLACE VIEW events_unified AS
SELECT 'HOT' AS data_tier, * FROM events_hot
UNION ALL
SELECT 'WARM' AS data_tier, * FROM events_warm
UNION ALL
SELECT 'COLD' AS data_tier, * FROM events_cold;

Best Practices

The tier table below is the artifact to bring into the interview: one row per tier with its storage type, its query frequency, and its retention, followed by the arithmetic of what a move saves each month. What the table hides is transition cost โ€” every tier move is a COPY INTO plus a DELETE, billed as compute against the hot table โ€” so cadence for most estates belongs in weeks, not hours, and a lifecycle procedure that runs every night is usually moving data faster than the access pattern justifies.

TierStorage TypeUse CaseRetention
HotSnowflake NativeFrequently queried, < 90 days90 days
WarmExternal TablesInfrequently queried, 90-365 days1 year
ColdIcebergArchival, > 365 daysYears
ArchiveS3 GlacierCompliance, > 7 yearsPermanent

โš ๏ธ

Key Trade-offs:

  1. Native tables โ€” Best performance, highest cost
  2. External tables โ€” Good for querying data in place, slower than native
  3. Iceberg tables โ€” Open format, supports time travel, good for cross-platform access
  4. Hybrid approach โ€” Balance cost and performance based on access patterns

Key Takeaways

  • External tables keep files as the source of truth โ€” metadata-only in Snowflake, read-only by design, auto-refreshed through notification integrations, and slower than native on every query.
  • Iceberg tables put the open format in your own bucket: snapshot time travel, partition transforms that hide from the query, full DML in Snowflake, and maintenance someone must schedule.
  • Hybrid tiering saves money only when access is skewed โ€” verify with bytes-scanned telemetry per table before trusting a hot, warm, or cold label.
  • Tier moves are COPY INTO plus DELETE, billed as compute, so run lifecycle procedures on a weekly cadence and expose the tier column so SLAs stay honest.
๐Ÿ”’

Premium Content

Topic: Data Lakehouse, External Tables & Iceberg

You've previewed the first section. Unlock this full lesson and 900+ advanced tutorials with a Premium plan.

๐ŸŽฏEnd-to-end Projects
๐Ÿ’ผInterview Prep
๐Ÿ“œCertificates
๐ŸคCommunity Access

Already a member? Log in

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-17

โ€”
โ˜†โ˜†โ˜†โ˜†โ˜†
0 ratings

Rate & Feedback

Advertisement