Module 08 · Lesson 7 of 12Detailed study · about 15 min

Monitor queues, recover missed files and control retries

Trace a file through arrival, notification, queue, load history and target rows before deciding how to retry it.

Understand the idea

REFRESH considers files staged within the last seven days. It is not a historical backfill scheduler and does not retry files already processed with errors. For older data, plan a bounded bulk COPY backfill with a manifest and a non-overlapping cutover to live ingestion.

Key ideas in simple English
ConceptWhat it means
SYSTEM$PIPE_STATUSExecution state, pending work and notification activity.
COPY_HISTORYPer-file outcomes and errors.
ALTER PIPE REFRESHQueues eligible recent files missed by notifications.
Duplicate preventionFile metadata is not business-key deduplication.

A concrete example

A file exists in storage but has no history entry. Diagnose notification delivery before forcing a load.

Remember: REFRESH is not a general replay command, and recreating a pipe can lose its load metadata.

Explain it step by step · full theory

Setup and reasoning

REFRESH considers files staged within the last seven days. It is not a historical backfill scheduler and does not retry files already processed with errors. For older data, plan a bounded bulk COPY backfill with a manifest and a non-overlapping cutover to live ingestion.

Snowpipe maintains pipe-specific file tracking, with a 14-day load metadata window. Renamed files or recreated pipes can bypass previous protection. Keep object names immutable, retain source data and reconcile IDs. Correct a failed file under a deliberate new identity or follow the documented reload procedure; do not blindly FORCE.

Check storage access, event filters, queue permissions, paused/stale state and parsing errors in that order. Use a warehouse only for diagnostic SELECTs. Monitor freshness alongside queue size: an empty queue can mean no notifications arrived.

Words used in this lesson
SYSTEM$PIPE_STATUS
Execution state, pending work and notification activity.
COPY_HISTORY
Per-file outcomes and errors.
ALTER PIPE REFRESH
Queues eligible recent files missed by notifications.
Duplicate prevention
File metadata is not business-key deduplication.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Monitor queues, recover missed files and control retries

SYSTEM$PIPE_STATUS
COPY_HISTORY

Identify the input

Trace a file through arrival, notification, queue, load history and target rows before deciding how to retry it.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Identify the input

    Trace a file through arrival, notification, queue, load history and target rows before deciding how to retry it.

  2. Follow delivery

    A file exists in storage but has no history entry. Diagnose notification delivery before forcing a load.

  3. Verify and recover

    REFRESH is not a general replay command, and recreating a pipe can lose its load metadata.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Manual examples only. Complete Modules 05–07 and the first lesson’s M8_LAB setup. Select L2_OBJECTS_LAB.M8_LAB in each SQL session. Replace every placeholder and choose exactly one cloud provider. Cloud IAM/notifications require authorized setup; streaming protocol outlines are explicitly non-executable. No credentials belong in this website.

Inspect status and file history

SQL · example
SELECT SYSTEM$PIPE_STATUS('L2_OBJECTS_LAB.M8_LAB.M8_AUTO_PIPE');
SELECT * FROM TABLE(L2_OBJECTS_LAB.INFORMATION_SCHEMA.COPY_HISTORY(
 TABLE_NAME=>'L2_OBJECTS_LAB.M8_LAB.M8_FILE_EVENTS',
 START_TIME=>DATEADD('hour',-24,CURRENT_TIMESTAMP())));
SELECT COUNT(*) FROM M8_FILE_EVENTS;

What to expect and why

Inspect executionState, pendingFileCount, timestamps and per-file errors. Counts alone do not explain which files contributed rows.

Recovery commands — use only after diagnosis

SQL · example
-- Recent, unprocessed missed files under the stage-relative prefix:
ALTER PIPE M8_AUTO_PIPE REFRESH PREFIX='missed/';
-- Operational pause/resume; not a reset of metadata:
ALTER PIPE M8_AUTO_PIPE SET PIPE_EXECUTION_PAUSED=TRUE;
ALTER PIPE M8_AUTO_PIPE SET PIPE_EXECUTION_PAUSED=FALSE;

What to expect and why

Run REFRESH only for the intended recent missing prefix. Pause and resume require pipe privileges. Long pauses require a deliberate catch-up plan.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Will REFRESH automatically reload a file that previously failed?

Try it yourself

How do you avoid loading historical files twice during a cutover?

Compare your reasoning

Choose a time/path boundary, record the backfill manifest, reconcile completed files and point live ingestion at a disjoint prefix or verified boundary.

Official sources and curriculum

Module 08 · See module scope