skip to content

When would you choose Snowpipe over a scheduled COPY INTO in Snowflake, and what does it cost?

level: seniorimportance: should knowfreq 62%

answer

  1. One path is event-driven, the other is scheduled
  2. No warehouse is named in a pipe definition
  3. Charging has a component that counts files, not bytes
  4. Freshness is minutes, ordering is not guaranteed
  5. Micro-batch or the per-file overhead dominates

basics

~20 s

Snowpipe loads files within about a minute of arrival on Snowflake-managed serverless compute, billed per second plus a per-file overhead, so it suits continuous small-batch arrival. A scheduled COPY INTO on your own warehouse is cheaper and more controllable for large periodic batches.

solid answer

~50 s

A **pipe** wraps a `COPY INTO` statement: `CREATE PIPE p AUTO_INGEST = TRUE AS COPY INTO orders FROM @ext_orders`. With `AUTO_INGEST`, cloud event notifications (S3 event → SQS, Azure Event Grid, GCS Pub/Sub) tell Snowpipe a new object landed and it loads it, typically within a minute; alternatively a client calls the REST `insertFiles` endpoint. It uses **Snowflake-managed serverless compute** — no virtual warehouse to size, suspend or resume — billed per compute-second plus a per-file overhead, which is why thousands of tiny files are disproportionately expensive. Choose Snowpipe when data arrives continuously and freshness in minutes matters. Choose scheduled `COPY` when data arrives as large periodic batches, when you want `ABORT_STATEMENT` all-or-nothing semantics, or when the load must sit inside a transformation job you control. Snowpipe does not guarantee load ordering, defaults to `ON_ERROR = SKIP_FILE`, and is monitored with `SYSTEM$PIPE_STATUS`.

code

sql · 13 lines
sql
CREATE PIPE orders_pipe
  AUTO_INGEST = TRUE
AS
  COPY INTO orders_raw
  FROM @ext_orders
  FILE_FORMAT = (FORMAT_NAME = my_parquet);

-- notification channel to wire into the bucket's events
SHOW PIPES LIKE 'orders_pipe';

-- health check and repair after a notification gap
SELECT SYSTEM$PIPE_STATUS('orders_pipe');
ALTER PIPE orders_pipe REFRESH;

go deeper

for a junior

Know that a pipe wraps a COPY INTO and loads files automatically as they arrive, without you scheduling anything or picking a warehouse.

for a middle

Explain the trigger mechanisms (cloud event notification versus the REST insertFiles call), the roughly one-minute freshness, and that billing is serverless compute plus a per-file component.

for a senior

Argue the choice with evidence: measure credits per pipe, set micro-batch sizes, handle the no-ordering guarantee and SKIP_FILE default, and have a documented repair path for missed notifications.

for a principal

Own the ingestion pattern across the estate — which datasets justify minute-level freshness, where a periodic COPY sweep backstops the stream, and how per-file overhead shapes the contract you give producing teams.

## What a pipe is ```sql CREATE PIPE orders_pipe AUTO_INGEST = TRUE AS COPY INTO orders FROM @ext_orders FILE_FORMAT = (FORMAT_NAME = my_parquet); ``` A pipe is a named object holding a `COPY INTO` statement that Snowflake runs for you, one file at a time, as files show up. It is not a scheduler and not a stream processor — it is event-driven bulk load at file granularity. ## Two ways to trigger it **Auto-ingest.** `AUTO_INGEST = TRUE` on a pipe over an **external** stage makes Snowflake subscribe to a cloud notification channel. `SHOW PIPES` returns the channel to point your bucket's event configuration at (an SQS ARN on AWS; on Azure and GCS you wire Event Grid or Pub/Sub through a notification integration). When an object lands, the notification arrives and the file is queued for load. **REST.** A client calls the `insertFiles` endpoint listing files to ingest, using key-pair authentication. This is what the Kafka connector and many custom loaders do, and it is the option for internal stages, where no cloud notification exists. ## Latency, ordering and errors Snowpipe targets loading a file shortly after it is notified — think roughly a minute under normal conditions, longer when a queue backs up or files are very large. It makes **no ordering guarantee**: files are not necessarily loaded in the order they arrived, so anything order-sensitive must be reconstructed from a column in the data, not from arrival. Its default `ON_ERROR` is `SKIP_FILE`, not the bulk `COPY` default of `ABORT_STATEMENT` — a bad file is set aside and the stream keeps flowing. That is right for a continuous pipeline and wrong for a batch you need atomically. Pipe-level error notifications can push failures to a cloud notification service so a bad file is not discovered days later. Pipes keep their own load history, retained for a shorter window than the 64 days of table load metadata, and `SYSTEM$PIPE_STATUS('orders_pipe')` returns execution state, pending file count and the last error. `ALTER PIPE orders_pipe REFRESH` re-queues recently staged files that were missed — the usual repair after a notification outage — but its lookback is limited, so a long outage needs a manual `COPY` over the affected prefix instead. ## Cost model Snowpipe does not consume a virtual warehouse. Snowflake runs the load on its own compute and charges per compute-second used, **plus a fixed overhead per file processed**. Two consequences: - **Tiny files are expensive per byte.** A pipeline emitting a file per second pays the per-file overhead 86,400 times a day for very little data. Micro-batch at the producer instead — accumulate for roughly a minute and write one file in the usual 100–250 MB compressed range where volume permits. - **Large steady batches are cheaper on your own warehouse.** A nightly 2 TB dump loaded by a `COPY` on a right-sized warehouse that auto-suspends afterwards typically beats paying per-file serverless overhead for the same files. `SNOWFLAKE.ACCOUNT_USAGE.PIPE_USAGE_HISTORY` gives credits and bytes per pipe, which is how you settle the argument with numbers rather than intuition. ## Choosing between them Reach for **Snowpipe** when: files arrive unpredictably and continuously; freshness of minutes is a product requirement; you do not want to own warehouse scheduling; the producer is a streaming sink already writing objects to a bucket. Reach for **scheduled `COPY`** when: data arrives in large periodic drops; you need all-or-nothing semantics or a validation dry run before loading; the load is one step of a larger transformation job that also needs a warehouse anyway; the volume is large enough that per-file overhead matters. A very common production shape is both: Snowpipe for the continuous stream into a raw landing table, plus a scheduled task that merges and reconciles, with a periodic `COPY` sweep as the backstop for anything the notification channel dropped. ## Snowpipe Streaming is a different thing Snowpipe Streaming is a separate API that writes **rows** into a table over a channel, with no files and no stage, aimed at lower latency than file-based Snowpipe. Know that it exists and that it is not the same product surface as a pipe over a stage; do not conflate their cost or trigger models. ## What interviewers want They want the cost sentence — serverless compute plus per-file overhead — the freshness sentence — about a minute, no ordering guarantee — and evidence that you would not pick a streaming path for a nightly batch just because it sounds modern.

  • Snowpipe stopped loading after a cloud notification outage. How do you reconcile the missed files?
    Check `SYSTEM$PIPE_STATUS` for the execution state and pending count first. `ALTER PIPE ... REFRESH` re-queues recently staged files and repairs a short gap. Its lookback window is limited, so for a longer outage run a normal `COPY INTO` over the affected stage prefix — load metadata still prevents re-loading anything the pipe already ingested.
  • Why does Snowpipe default to ON_ERROR = SKIP_FILE while bulk COPY defaults to ABORT_STATEMENT?
    A pipe is a continuous, unattended stream: aborting on one malformed file would stall ingestion for every subsequent file. Skipping quarantines the bad file and keeps the pipeline flowing, at the cost of a silent gap — which is why pipe error notifications matter. Bulk `COPY` is an attended, transactional batch where all-or-nothing is the safer default.
  • A team emits one 8 KB file per second into a Snowpipe-monitored bucket. What do you tell them?
    They are paying the per-file overhead 86,400 times a day for well under a gigabyte, and the load is dominated by fixed cost rather than data. Have the producer buffer for 30–60 seconds and emit one larger object; freshness barely changes while cost drops sharply. If sub-second row latency is genuinely required, that is a case for Snowpipe Streaming, not for smaller files.

saying these in an interview costs you the question

  • Saying Snowpipe runs on a virtual warehouse you size
  • Assuming Snowpipe guarantees files load in arrival order
  • Treating Snowpipe as real-time streaming with sub-second latency
  • Ignoring per-file charges when emitting thousands of tiny files
  • Using Snowpipe for a single large nightly batch load

context