Snowflake 账单里,每份副本都有一行不起眼的明细。
Snowflake bill has a quiet line for every copy

原始链接: https://medium.com/@yanivleven/your-snowflake-bill-has-a-quiet-line-for-every-copy-7d3799efaaf9

Snowflake 的《移动数据的隐性成本》认为,每一份新副本都应被视为一笔费用,而不是例行的数据搬运。完整成本可能包括跨区域或跨云出站流量、计入目标账户账单的复制数据传输和计算费用、二级数据库或重复表的存储、Time Travel/Fail-safe 字节、克隆分歧,以及用于持续刷新副本的仓库。 在创建另一份副本之前——尤其是仅仅为了让 AI 或分析团队访问数据——团队应先衡量现有的数据移动和存储:DATA_TRANSFER_HISTORY 显示字节数、区域和传输类型;TABLE_STORAGE_METRICS 揭示独立副本、克隆和保留字节;REPLICATION_GROUP_USAGE_HISTORY 跟踪目标账户中的复制积分。 合理的副本(例如灾难恢复或区域故障转移)可能值得其成本。但开放的 Iceberg 表和 Horizon Catalog 现在让 Spark、Trino 及其他工具能够就地查询受治理的数据,并应用脱敏和行访问策略,从而减少重复数据集的需求。仍需注意:就地查询仍会消耗计算资源,跨区域 Iceberg 读写可能显示为 DATA_LAKE 传输。 实用规则:先算清传输、复制、存储和同步成本,再证明副本的合理性——或者把工作负载带到数据所在处。

黑客新闻 最新 | 往期 | 评论 | 问答 | 展示 | 招聘 | 投稿 登录 Snowflake 账单中,每个副本都对应一行不起眼的记录 (medium.com/yanivleven) 3 分 作者 yanivleven 1 小时前 | 往期 | 收藏 | 讨论 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系我们 搜索:
相关文章

原文
Yaniv Leven

Snowflake’s latest architecture post, The Hidden Cost of Moving Data, puts it plainly: “Every time you move data, it adds cost and risk.” The usual reason is still the old playbook. Centralize first, then do analytics, then do AI. That sequence made sense when each system could only query its own data. It is a much more expensive habit now.

This isn’t an argument against every copy. Disaster recovery, a regional failover, or a one-off extract can be the right call. It is an argument for seeing what those copies actually cost, and for not making a new one just so a model can reach the data.

A “copy” is rarely one line item. In Snowflake it usually shows up in some mix of these:

  • Data transfer, or egress. Snowflake “charges a per-byte fee for data egress when users transfer data from a Snowflake account into a different region on the same cloud platform or into a completely different cloud platform.” Transfers within the same region are free. Snowflake does not charge for ingress, though your cloud provider might charge you to send data into Snowflake. The rate depends on where the account is hosted; use your contract or the pricing guide, not a guess.
  • Replication compute and storage. Replication billing is split into data transfer and compute, “billed on the target account.” The target also pays standard storage for each secondary database, and monthly cost scales with how much primary data changes and how often you refresh. You can stop the meter by stopping refresh operations.
  • Storage for the extra copy itself. A CREATE TABLE … AS SELECT or an unload-and-reload is a full second copy, billed like any other table, including Time Travel and Fail-safe. A zero-copy clone is different: it “initially shares the underlying storage” and “does not incur any additional costs (until changes are made to the cloned object).” Once the clone diverges, or the source deletes data the clone still needs, those bytes are billed, including as RETAINED_FOR_CLONE_BYTES.

And then there is the unglamorous fourth cost: the warehouse that runs every night to keep the copy in sync. That compute isn’t labeled “copy” on the statement. It just looks like another pipeline.

One “we need a copy” decision, four costs: egress, replication credits, duplicate storage, and a nightly warehouse that keeps the copy in sync.

Press enter or click to view image in full size

Start with DATA_TRANSFER_HISTORY. It records bytes moved, the source and target cloud and region, and a TRANSFER_TYPE (COPY, COPY_FILES, REPLICATION, DATA_LAKE, EXTERNAL_ACCESS, EXTERNAL_FUNCTION, INTERNAL, POSTGRES, or SNOWPARK_CONTAINER_SERVICES). Latency can be up to two hours. The docs type BYTES_TRANSFERRED as VARIANT, so the query casts it:

SELECT transfer_type,
source_cloud, source_region,
target_cloud, target_region,
SUM(bytes_transferred::NUMBER) / POWER(1024, 3) AS gb_transferred
FROM snowflake.account_usage.data_transfer_history
WHERE start_time >= DATEADD('day', -30, CURRENT_TIMESTAMP())
GROUP BY ALL
ORDER BY gb_transferred DESC;

Same-region rows, if you see them, shouldn’t be a Snowflake egress charge. Cross-region REPLICATION and COPY (unloads to a stage in another region) usually are. DATA_LAKE is the one to watch if you write or read Iceberg files across regions or clouds; Snowflake bills that transfer even when you think you’re leaving the data “in place.”

Then look at the tables that are already sitting around as copies. TABLE_STORAGE_METRICS has the clone relationship (CLONE_GROUP_ID equals ID unless the table is a clone) and the bytes Snowflake bills:

SELECT table_catalog, table_schema, table_name,
IFF(clone_group_id = id, 'standalone', 'clone') AS copy_type,
active_bytes / POWER(1024, 3) AS active_gb,
time_travel_bytes / POWER(1024, 3) AS time_travel_gb,
failsafe_bytes / POWER(1024, 3) AS failsafe_gb,
retained_for_clone_bytes / POWER(1024, 3) AS retained_for_clone_gb
FROM snowflake.account_usage.table_storage_metrics
WHERE table_dropped IS NULL
ORDER BY active_gb + time_travel_gb + failsafe_gb + retained_for_clone_gb DESC
LIMIT 25;

A clone with almost no ACTIVE_BYTES of its own is cheap. A standalone table with a name like _COPY, _BACKUP or _SANDBOX and a large ACTIVE_GB is often a second full copy you forgot to retire. For replication groups, use REPLICATION_GROUP_USAGE_HISTORY in the target account: CREDITS_USED and BYTES_TRANSFERRED per secondary group, with up to three hours of latency.

Map 30 days of data movement between regions, then compare the large standalone copies with the nearly empty clones.

Press enter or click to view image in full size

Sometimes the copy is the product: a failover group in another region, or a tightly controlled extract. Often it isn’t. If the goal is “the AI team needs this data,” ask whether they can query it where it already lives.

Snowflake’s post argues that open table formats broke the old rule that you had to move data before you could compute on it. Horizon Catalog is the governance half of that idea. The docs say masking and row-access policies “are enforced across any Iceberg REST Catalog-compatible engine,” and that you can query Iceberg tables from Spark, Flink and Trino through the Iceberg REST Catalog API with “governance… enforced automatically.” The November 11 post adds that Horizon now extends those row access and masking policies to Spark, Trino and PyIceberg, in public preview, and that each operation is recorded in Snowflake’s access history.

That is the practical test. If a policy can travel with the data, a copy that exists only so another engine can see a governed subset is harder to justify. Two caveats, both from the docs: query-in-place is not a free pass on compute, and a cross-region Iceberg read or write can still show up as DATA_LAKE transfer. Measure those before you declare the copy unnecessary.

Get Yaniv Leven’s stories in your inbox

Join Medium for free to get updates from this writer.

A nightly copy pays for egress, storage and a sync job. Spark and Trino can query the same Iceberg table in place, under the same governance policies.

Press enter or click to view image in full size

At Seemore, we put transfer, replication and copy-storage next to the warehouses that keep those copies current, so a forgotten _BACKUP table and the job that refreshes it show up as one cost, not two unrelated lines. The point is to see the full price of a copy before you approve the next one.

Moving data is a bill, not a background task. Add up egress, replication credits, the storage the copy occupies, and the pipeline that maintains it. Keep the copies you can defend. For the rest, see whether the workload can come to the data, with the same policies attached.

When does Snowflake charge for data transfer?

When data leaves a region or a cloud platform. Transfers within the same region are free. Snowflake does not charge for ingress, but your cloud provider might.

Who pays for Snowflake replication?

The target account pays for data transfer and replication compute, plus storage for each secondary database. Cost tracks how much primary data changes and how often you refresh.

Do clones count as a second copy on the storage bill?

Not at first. A zero-copy clone shares storage with its source until one of them changes, or until the source deletes data the clone still references. Those diverging or retained bytes are billed.

If I query Iceberg data in place, is transfer always zero?

No. Same-region transfer is free, but Snowflake bills cross-region or cross-cloud Iceberg reads and writes. Check DATA_TRANSFER_HISTORY for the DATA_LAKE transfer type.

Can masking and row access policies follow the data to Spark or Trino?

Horizon Catalog documents policy enforcement on Iceberg REST Catalog-compatible engines, including Spark and Trino. Snowflake’s November 11 post says support for Spark, Trino and PyIceberg is in public preview. Confirm the status in your account before you rely on it.

Want to see what your copies actually cost? Visit Seemore Data.

联系我们 contact @ memedata.com