Measuring the Processing Time and Cost of Snowflake External Tables, Tasks, and Snowpipe

Measuring the Processing Time and Cost of Snowflake External Tables, Tasks, and Snowpipe

We compare cost and processing time across three ways to load S3 data into Snowflake (external tables, Task + COPY INTO, and Snowpipe), based on hands-on implementation and measurement.
2026.10.18

This page has been translated by machine translation. View original

Introduction

This is kasama from the Data Business Division.
There are several patterns for using S3 data in Snowflake, so in this article I'd like to compare the processing time and cost of each.

Prerequisites

Assumed usage

This article assumes the bronze layer (the raw data ingestion layer) of a bronze/silver/gold architecture. The bronze tables are referenced by downstream dbt models in a daily batch.

The number of times a bronze table is referenced per day is the sum of the number of downstream models and the number of tests written on the source. In this article, I calculate the monthly cost for 1, 5, and 20 references per day.

The four configurations

Configuration How S3 data is handled Ingestion compute and billing Measured tables
External table Not loaded into a Snowflake table. S3 files are read on every reference None EXTERNAL_ORDERS_*
user-managed Task A Task's COPY INTO loads the S3 files into a Snowflake table A Warehouse created by the user. Billed for a minimum of 60 seconds each time it starts USER_MANAGED_ORDERS_*
serverless Task A Task's COPY INTO loads the S3 files into a Snowflake table Compute provided by Snowflake. Billed per second for what is used SERVERLESS_ORDERS_*
Snowpipe Receives S3 event notifications, and Snowpipe loads the files in the same way Compute provided by Snowflake. Billed by the amount of data ingested SNOWPIPE_ORDERS_*

The two Tasks run the same COPY INTO. The difference is in billing: serverless Tasks have no 60-second minimum charge.

https://docs.snowflake.com/en/user-guide/cost-understanding-compute

Implementation

The implementation code is stored on GitHub.

https://github.com/cm-yoshikikasama/blog_code/tree/main/71_snowflake_ingestion_cost_bench

.
├── terraform/
│   ├── versions.tf
│   ├── providers.tf
│   ├── variables.tf
│   ├── s3.tf
│   ├── iam.tf
│   ├── database.tf
│   ├── stage.tf
│   ├── warehouse.tf
│   ├── table.tf
│   ├── task.tf
│   ├── pipe.tf
│   └── outputs.tf
├── scripts/
│   └── generate_data.py
└── sql/
    ├── 01_refresh_external.sql
    ├── 02_run_tasks.sql
    ├── 03_reset_snowpipe.sql
    ├── 04_reference.sql
    ├── 05_measure.sql
    └── check.sql

The environment is built with Terraform, and all Snowflake operations are done with SQL files. Python is used only to generate the test data.

Terraform

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/iam.tf

iam.tf creates the IAM role that lets Snowflake read S3. The trust policy is set with the IAM user ARN and External ID obtained from the Storage Integration's describe_output. The permission is read-only on cost-bench/. The Storage Integration uses the IAM role's ARN, and the IAM role uses the Storage Integration's values, so they reference each other. Therefore, the role ARN passed to the Storage Integration is built as a string from the account ID and role name in variables.tf. This way, the AWS and Snowflake resources can be created in a single apply.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/stage.tf

stage.tf creates the Storage Integration, the CSV file format, and the external stage. depends_on is specified so that the stage is created after the IAM role and policy exist.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/s3.tf

s3.tf creates the S3 bucket that holds the test data and the event notifications for Snowpipe. Notifications are sent, for each cost-bench/snowpipe/<size>/ prefix, to the SQS queue of the Pipe for that size.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/warehouse.tf

warehouse.tf creates four Gen2 XS Warehouses: one for reference, and three for the user-managed Tasks, one per size. The user-managed Task Warehouses are separated by size so that the charges for each size can be retrieved separately from WAREHOUSE_METERING_HISTORY.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/table.tf

table.tf creates the external tables and the destination tables for ingestion. The external tables cast columns 1 to 9 of the CSV (value:c1 to value:c9) into typed columns.

I set refresh_on_create = false because at creation time there is no data in S3, and the IAM role settings may not yet have taken effect. The file list is loaded with 01_refresh_external.sql after the test data is placed.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/task.tf

task.tf creates the user-managed Task and the serverless Task. The two Tasks run the same COPY INTO, and the only difference is the compute specification. The user-managed Task specifies a Warehouse in warehouse, and the serverless Task specifies a range of compute sizes (XSMALL to SMALL).

COPY INTO has FORCE = TRUE. Since COPY INTO skips files that have already been loaded, I specified it so that the same files could be measured three times. Tasks are run manually with EXECUTE TASK in 02_run_tasks.sql.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/terraform/pipe.tf

pipe.tf creates a Pipe per size with AUTO_INGEST enabled. Each Pipe loads the files placed under snowpipe/<size>/ into SNOWPIPE_ORDERS_<size>.

versions.tf, providers.tf, variables.tf, database.tf, and outputs.tf only contain the provider settings, variables, the database, and the bucket name output, so I omit their explanation. The state is kept in a local terraform.tfstate.

Python

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/scripts/generate_data.py

generate_data.py creates 9-column CSV files and places them in S3. When a file reaches about 200MB, it is uploaded, the local file is deleted, and then the next file is created. The random seed is fixed for each size, so the same data is produced no matter how many times it is run.

SQL

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/sql/02_run_tasks.sql

The SQL files 01 to 04 are separated by measurement step. 02_run_tasks.sql runs TRUNCATE on the destination tables and then runs the six Tasks with EXECUTE TASK. 04_reference.sql disables the result cache and then reads the 12 tables with CTAS.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/sql/05_measure.sql

05_measure.sql builds the result tables from Snowflake's history. First, it saves the database creation time in the variable BENCH_START as the time to start aggregating.

The Warehouse billing history is in hourly units, and it remains by name even if the Warehouse is deleted. Therefore, to avoid mixing in past charges of a Warehouse recreated with the same name, only the history after this time is aggregated.

Next, it aggregates the reference seconds (REFERENCE_SEC), the Task ingestion seconds (TASK_SEC), the Snowpipe ingestion seconds (SNOWPIPE_SEC), and the ingestion Credits (INGEST_CREDITS) into temporary tables, and joins them by configuration and size in RESULT. The last two SELECTs output the result table and the monthly cost table from RESULT, so run the whole file in the same session.

If PIPE_USAGE_HISTORY is called without the PIPE_NAME argument, the Pipe name is returned empty. Therefore, the Snowpipe charges are retrieved by calling the function for each Pipe.

Deployment

The following commands are run in the 71_snowflake_ingestion_cost_bench directory.

1. Create the environment

export AWS_PROFILE='<your-profile>'
export SNOWFLAKE_ORGANIZATION_NAME='<your-organization-name>'
export SNOWFLAKE_ACCOUNT_NAME='<your-account-name>'
export SNOWFLAKE_USER='<your-user>'
export SNOWFLAKE_AUTHENTICATOR='PROGRAMMATIC_ACCESS_TOKEN'
export SNOWFLAKE_TOKEN='<your-pat>'

terraform -chdir=terraform init
terraform -chdir=terraform apply

On the first apply, the Pipe is created before the IAM role settings take effect, so the Pipe creation may fail. In that case, wait about 30 seconds and apply again.

2. Create the test data

Upload scripts/generate_data.py to AWS CloudShell and run it. Running it in CloudShell lets you upload to S3 without using your local connection.

python3 generate_data.py --bucket <bucket_name>

You can check <bucket_name> with terraform -chdir=terraform output bucket_name. When run, CSVs of three sizes are placed in s3://<bucket_name>/cost-bench/<size>/ as follows.

uploaded s3://<bucket_name>/cost-bench/10MB/orders_0000.csv (10,110,285 bytes)
10MB: 1 files, 10,110,285 bytes, 81,000 rows
uploaded s3://<bucket_name>/cost-bench/100MB/orders_0000.csv (100,029,855 bytes)
100MB: 1 files, 100,029,855 bytes, 795,000 rows
uploaded s3://<bucket_name>/cost-bench/1GB/orders_0000.csv (200,001,388 bytes)
uploaded s3://<bucket_name>/cost-bench/1GB/orders_0001.csv (200,102,463 bytes)
uploaded s3://<bucket_name>/cost-bench/1GB/orders_0002.csv (200,096,401 bytes)
uploaded s3://<bucket_name>/cost-bench/1GB/orders_0003.csv (200,104,362 bytes)
uploaded s3://<bucket_name>/cost-bench/1GB/orders_0004.csv (199,714,234 bytes)
1GB: 5 files, 1,000,018,848 bytes, 7,885,000 rows

Measurement

Run the SQL files in a Snowsight worksheet or with snow sql -f. For each configuration, run ingestion and reference in the following steps.

1. Load the file list into the external tables

Run sql/01_refresh_external.sql. The external tables reference only the files loaded by this operation.

2. Ingest three times with the user-managed Task and the serverless Task

Run sql/02_run_tasks.sql three times. Leave two and a half minutes between runs, and run the next one after the user-managed Task's Warehouse has auto-suspended. Check Task completion with sql/check.sql.

3. Ingest three times with Snowpipe

Empty the destination tables with sql/03_reset_snowpipe.sql, and then copy the test data within S3 to the Snowpipe folder.

for SIZE in 10MB 100MB 1GB; do
  aws s3 cp --recursive \
    s3://<bucket_name>/cost-bench/${SIZE}/ \
    s3://<bucket_name>/cost-bench/snowpipe/${SIZE}/run1/
done

Snowpipe starts ingesting upon receiving notifications for the copied files. When the row counts in sql/check.sql match the test data, repeat the same operation with the folder name changed to run2 and run3.

4. Reference the tables of the four configurations three times

Run sql/04_reference.sql three times. This SQL reads the tables of the four configurations once each with the same CTAS as a dbt table model (CREATE OR REPLACE TRANSIENT TABLE ... AS SELECT * FROM ...).

The Warehouse is started before the CTAS so that the Warehouse startup time is not included in the first CTAS.

5. Aggregate the results

Run sql/05_measure.sql. To redo the measurement, run terraform destroy and then start from step 1 of the deployment.

Results

Test conditions

The test data is uncompressed 9-column CSV. I prepared three sizes as the amount ingested into one table per day.

Size Number of files Per file Rows
10MB 1 ~10MB 81,000
100MB 1 ~100MB 795,000
1GB 5 ~200MB 7,885,000
  • Warehouse: all Gen2 XS, AUTO_SUSPEND is 60 seconds
  • user-managed Task: runs on a dedicated Warehouse for each size
  • serverless Task: compute size is XSMALL to SMALL
  • Number of runs: Task runs, Snowpipe ingestion, and reference CTAS were each run three times for every combination of configuration and size, and the averages are reported

Each item was obtained from the following histories.

Item How it was obtained
Task ingestion seconds From SCHEDULED_TIME to COMPLETED_TIME in TASK_HISTORY
Snowpipe ingestion seconds From the time the last file was placed in S3 (last_modified from LIST) to the time the ingestion of the last file finished (LAST_LOAD_TIME in COPY_HISTORY)
Reference seconds TOTAL_ELAPSED_TIME in QUERY_HISTORY_BY_WAREHOUSE
Ingestion Credits The sum of the three runs from WAREHOUSE_METERING_HISTORY, SERVERLESS_TASK_HISTORY, and PIPE_USAGE_HISTORY, divided by 3

The Snowpipe ingestion seconds also include the time for the notification to reach Snowpipe from S3.

Credits are billed in the following way for each configuration.

Compute Configurations using it Billing mechanism
Warehouse user-managed Task, reference Billed per second while running. A minimum of 60 seconds is billed each time it starts or resumes. Gen2 XS is 1.35 credits/hour
serverless serverless Task The compute time used is calculated per second (rounded up for less than 1 second) and multiplied by a factor of 0.9. If run on XS, it is 0.9 credits/hour
Snowpipe Snowpipe The amount of data ingested is multiplied by 0.0037 credits per GB

The unit prices are listed in the Snowflake Service Consumption Table. Gen2 XS's 1.35 credits/hour is in Table 1(b), and the serverless Task multiplier of 0.9 and Snowpipe's 0.0037 credits/GB are in Table 5.

https://www.snowflake.com/legal-files/CreditConsumptionTable.pdf

Results by configuration

When the whole of sql/05_measure.sql is run, the second-to-last SELECT outputs the ingestion seconds, ingestion Credits, and reference seconds for each configuration and size. External tables do not ingest, so their ingestion seconds are null.

https://github.com/cm-yoshikikasama/blog_code/blob/main/71_snowflake_ingestion_cost_bench/sql/05_measure.sql

SELECT
    DECODE(
        CONFIG, 'EXTERNAL', '外部テーブル', 'USER_MANAGED', 'user-managed Task',
        'SERVERLESS', 'serverless Task', 'SNOWPIPE', 'Snowpipe'
    ) AS "構成",
    SIZE AS "サイズ",
    INGEST_SEC AS "取り込み秒",
    ROUND(INGEST_CREDITS, 6) AS "取り込みCredits",
    REFERENCE_SEC AS "参照秒"
FROM RESULT
ORDER BY DECODE(SIZE, '10MB', 1, '100MB', 2, 3), DECODE(CONFIG, 'EXTERNAL', 1, 'USER_MANAGED', 2, 'SERVERLESS', 3, 4);

For the external table, the CTAS time was more than double that of the three configurations that load into Snowflake tables.

The user-managed Task consumes Credits for about 60 to 70 seconds regardless of the ingestion time (2 to 10 seconds). This is because even after COPY INTO finishes, the Warehouse stays running and is billed for the 60 seconds of AUTO_SUSPEND.

The Snowpipe ingestion time was about 44 seconds even for 10MB. This is thought to be because the time from when the S3 notification arrives until ingestion starts is needed regardless of the data volume.

Monthly cost per table

The monthly cost was calculated with the following formulas.

参照Credits  = 参照秒 × 1.35 ÷ 3600   (Gen2 XSの1.35クレジット/時を秒あたりに換算)
1日のCredits = 取り込みCredits + 参照Credits × 参照回数
月額(円)     = 1日のCredits × 688円 × 30日
  • References are assumed to run on the Warehouse that is already running for the dbt batch. Therefore, the reference cost is calculated from the seconds actually used
  • The user-managed Task ingestion assumes that a dedicated Warehouse is started for the Task. The measured values, including the 60-second wait, are used as is
  • One credit is 688 yen, converting $4.30 for Enterprise Edition (AWS Tokyo) at $1 = 160 yen
  • Snowflake storage costs and Cloud Services costs are not included

https://www.snowflake.com/en/pricing-options/

The last SELECT outputs the monthly cost (yen) for each configuration and size by number of references.

SELECT
    DECODE(
        CONFIG, 'EXTERNAL', '外部テーブル', 'USER_MANAGED', 'user-managed Task',
        'SERVERLESS', 'serverless Task', 'SNOWPIPE', 'Snowpipe'
    ) AS "構成",
    SIZE AS "サイズ",
    ROUND((INGEST_CREDITS + 1 * REFERENCE_SEC * 1.35 / 3600) * 688 * 30) AS "月額(参照1回/日)",
    ROUND((INGEST_CREDITS + 5 * REFERENCE_SEC * 1.35 / 3600) * 688 * 30) AS "月額(参照5回/日)",
    ROUND((INGEST_CREDITS + 20 * REFERENCE_SEC * 1.35 / 3600) * 688 * 30) AS "月額(参照20回/日)"
FROM RESULT
ORDER BY DECODE(SIZE, '10MB', 1, '100MB', 2, 3), DECODE(CONFIG, 'EXTERNAL', 1, 'USER_MANAGED', 2, 'SERVERLESS', 3, 4);

The gap in monthly cost between the external table and the serverless Task widens as the number of references and the size increase. At 20 references/day, the monthly costs of the external table and the serverless Task are 325 yen and 142 yen for 10MB, 1,486 yen and 266 yen for 100MB, and 2,616 yen and 783 yen for 1GB. The cause of the difference is the processing time of a single reference. References run on the same Warehouse (Gen2 XS) for all four configurations, so the reference cost is proportional to the reference seconds. At 1GB, the reference seconds are 16.9 and 4.7, making the cost of a single reference about 4.36 yen and about 1.21 yen.

The difference between the serverless Task and Snowpipe was within a few tens of yen per month under every condition. The user-managed Task, assuming a dedicated Warehouse is started, costs about 480 yen or more per month at any size.

Conclusion

The characteristics of the four configurations are as follows. The monthly cost is per table, and shows the range for 10MB to 1GB and 1 to 20 references/day.

Configuration Ingestion time Reference (CTAS) time 10MB / 100MB / 1GB Monthly cost Copy of data in Snowflake Source for Dynamic Table
External table No ingestion 2.1 / 9.6 / 16.9 sec 16–2,616 yen None Not usable
user-managed Task 2.4–9.6 sec 0.9 / 1.4 / 4.7 sec 479–1,256 yen Yes Usable
serverless Task 2.3–10.7 sec 0.9 / 1.6 / 4.7 sec 10–783 yen Yes Usable
Snowpipe 39.3–55.8 sec 0.9 / 1.8 / 5.1 sec 8–861 yen Yes Usable

When ingesting, choose the serverless Task for a batch job that runs at a fixed time. Choose Snowpipe for an event-driven job that runs whenever a file arrives. The monthly costs of the two are almost the same under every condition, so decide based on how the job is triggered.

The official documentation recommends serverless Tasks when few Tasks run concurrently or they finish in a short time. Bronze layer ingestion where a once-a-day COPY INTO finishes in around 10 seconds, as in this article, fits this condition.

The user-managed Task is recommended when multiple Tasks run concurrently and use up the Warehouse. An example is a pipeline with a single Warehouse for the nightly batch. On this Warehouse, COPY INTO Tasks for dozens of sources and downstream aggregation Tasks run in the same time window. Warehouse billing is determined by the number of seconds it is running, and does not increase with the number of Tasks running concurrently. When you add a Task to a running Warehouse, the additional cost is only the extra time the Warehouse stays running. Tasks whose compute exceeds the equivalent of XXLARGE cannot be run as serverless Tasks, so run them as user-managed Tasks.

https://docs.snowflake.com/en/user-guide/tasks-intro#recommendations-for-choosing-a-compute-model

Snowpipe ingests each time a file arrives in the stage. It suits, for example, cases where application logs are placed in S3 every few minutes and downstream processing also runs in the order they arrive. Snowpipe normally loads within 1 minute of detecting a file, but the latency is not guaranteed. The 39.3 to 55.8 seconds from placing the file in S3 to the end of ingestion in this test were also within 1 minute.

https://docs.snowflake.com/en/user-guide/data-load-snowpipe-intro

The external table was not the cheapest configuration under any condition. A single reference takes more than double the time of the other configurations, so the larger the number of references and the size, the higher the monthly cost compared with the other configurations. The official documentation also states that queries against external tables may be slower than against Snowflake tables. External tables suit cases where you want to reference only part of a large volume of data accumulated in S3 and do not want to ingest the rest into Snowflake. If you set up partitioning by date, only the files for the day being referenced are read. However, those files are parsed on every reference, so the time to read one day's worth takes more than double that of the ingested configurations, as in this measurement. The recommended file size is 256 to 512MB for Parquet and 16 to 256MB for other formats. For Parquet, Iceberg tables are recommended over external tables.

https://docs.snowflake.com/en/user-guide/tables-external-intro
https://docs.snowflake.com/en/user-guide/data-load-overview

Dynamic Tables cannot use an external table as a source. If you use Dynamic Tables in the silver layer and beyond, choose a configuration that ingests the data.

https://docs.snowflake.com/en/user-guide/dynamic-tables-limitations

Finally

The results this time were measured under the conditions of one table, 9-column uncompressed CSV, and a Gen2 XS Warehouse. The factors for choosing a configuration change depending on conditions such as the file format, the daily ingestion volume, the number of references, and whether the Warehouse is shared with other processing. Please treat it as just one example for reference.


Snowflakeの導入支援はクラスメソッドに!

クラスメソッドでは Snowflake の導入を支援しております。
製品の詳細や支援の内容についてお気軽にお問い合わせください。

Snowflakeの詳細を見る

Share this article