12-04 更新 实时
首页/ 技术栈/ 正文

高效列更新:添加与更新列提速 10 倍

技术栈 来源:Databricks Blog 2026-12-03 22:54 3 阅读 机器翻译
高效列更新:添加与更新列提速 10 倍

数据科学家和研究人员希望尽可能快速地用新数据和模型进行实验。然而,每一个新特征、标签或嵌入都需要填充或回填你的表,这会拖慢团队的速度并增加成本。

自动化研究会让这个问题放大许多个数量级。一名研究人员一周可能只会尝试几个新特征。而一个能够提出特征、添加特征、训练并检查结果的智能体,一小时内就能尝试这么多,而且每一次尝试都会触发一次全量重写。

今天我们发布 Beta 版的 Efficient Column Updates 来解决这个问题。当你新增一列并填充数据时,Databricks 现在只写入新的值。

在我们对一张 50 GB、包含 1,000 列的表进行的测试中,使用 Efficient Column Updates 新增一列并填充数据的速度快了 10 倍:88 秒,而不是 15 分钟。

问题所在:新增一列会重写整张表

面向 AI 和 ML 开发的表是横向增长的:某个想测试的特征、新一轮标注产生的质量分、来自最新模型的嵌入。

新增一个空列一直是瞬时完成的,但由于开放表格式中的一种名为“写时复制”(copy-on-write)的机制,回填这些值可能要花很长时间。该协议过去要求数据文件将所有列一起存储,因此把值写入新列意味着要完整地重写每一个文件,包括图像、文本、旧的嵌入等全部内容。

这带来 3 个重要影响:

重写未变更的数据:向一张有一千行的表添加一列,耗时大约等同于重写全部一千行。

自动化研究变得不切实际/昂贵:智能体通过尝试一个想法、检查结果、再试一次来改进模型。当每一次尝试都要重写整张表时,智能体就把时间和你的算力预算花在了重写上,而不是实验上。

变通方案变得难以维护:团队把新列放在副表里,或者把数据复制到另一个系统中,于是又多了一件需要保持同步并保障安全的事情。

表越大,每次实验的成本就越高,团队能尝试的想法也就越少。

引入高效的列更新

现在,当你填充一列时,Databricks 会把新值保存在每个现有数据文件旁边的 sidecar 文件中,而不改动现有文件。查询结果保持不变,因为引擎能够在读取时把两个文件拼接起来。

更新速度快:只写入新值,因此无论表变得多大,小改动始终是小任务。

熟悉的 SQL 语法:用 ALTER TABLE 添加列,用 UPDATE 填充。如果 Databricks 无法针对某次更新走快速路径,它会执行标准更新,你得到的结果完全相同。

一份数据副本:实验在其余工作所读取的同一张 Unity Catalog 托管表上进行,从而实现统一治理与一致的防护机制

如今,即便你的表变得更大,实验成本仍保持不变,让你的团队可以尽情尝试尽可能多的想法。

基准测试:向一张 1,000 列的宽表添加一个特征

在一张 50 GB、600 万行、1,000 列的表上,标准更新耗时 15 分钟。使用 Efficient Column Updates 后耗时 88 秒,提升 10 倍。

如何使用高效列更新

假设一个团队在 main.recsys.ctr_features 表上训练点击率模型,该表包含数百个用户特征和物品特征。一位研究员想再测试一个特征:每位用户过去 30 天的点击率。

1. 为该表开启此功能。工作区管理员先在 Previews 页面启用 Efficient Column Updates,然后设置一个表属性:

2. 添加该列并填充数据。

引擎计算新特征,只写入 user_ctr_30d。

3. 用它来训练。新列的行为与其他列完全一样:查询它、检查它,再把它加入模型的特征列表。如果它没有帮助,就尝试下一个想法(或者让智能体来做)。

Efficient Column Updates 现已在 Databricks Runtime 19 及以上版本的 Unity Catalog 托管 Delta 表中以 Beta 形式提供。Iceberg 支持即将推出:我们正与开源社区合作,将这一能力加入 Apache Iceberg™ 规范。

在工作区预览页面中启用该 Beta 功能

什么是 Efficient Column Updates?

Efficient Column Updates 是 Databricks 上的一项 Delta Lake 表特性,目前处于 Beta 阶段。当你新增一列并填充数据时,Databricks 只写入新值,不会重写那些未发生变化的列。

Efficient Column Updates 如何让新增列变得更快?

标准更新会把每个受影响的数据文件完整重新写入一遍。Efficient Column Updates 则把新值保存在单独的小文件中,原有文件保持不变,查询时会将两者作为一个表一起读取。更新过程仍需读取输入并计算新值,它省去的是重写这一步。

使用 Efficient Column Updates 需要修改我的 SQL 吗?

不需要。你可以使用 ALTER TABLE ... ADD COLUMN 添加一列,并通过 UPDATE 填入数据。

哪些表可以使用 Efficient Column Updates?

Unity Catalog 托管的 Delta 表,使用 Databricks Runtime 19 或更高版本进行读写。该表需要目录提交(catalog commits)、行跟踪(row tracking)、删除向量(deletion vectors)以及 id 模式下的列映射(column mapping),这些必须在创建表时设置。Iceberg 支持即将推出,我们正与开源 Iceberg 社区合作,将其添加到 Apache Iceberg 规范中。

我可以关闭 Efficient Column Updates 吗?

可以。将表属性设置为 false 以停止写入新的列文件,然后运行 REORG TABLE ... APPLY (PURGE),将现有的列文件合并回数据文件。你的值会保留。此后该表仍需要 Databricks Runtime 19 或更高版本,并且 Beta 版不支持 DROP FEATURE,因此请先在非关键表上试用。

获取最新文章,发送至你的收件箱

译文由英文原文机器翻译,术语按行业惯例统一,可在文末展开原文核对。

查看英文原文(Efficient column updates: add and update columns 10x faster)

Data scientists and researchers want to experiment with new data and models as quickly as possible. However, every new feature, label, or embedding requires populating or backfilling your tables, which slows down your team and costs money.

Automated research scales this problem by many orders of magnitude. A researcher might try a few new features a week. An agent that proposes a feature, adds it, trains, and checks the result can try that many in an hour, and every attempt triggers another full rewrite.

Today we're releasing Efficient Column Updates in Beta to solve this problem. When you add a column and fill it in, Databricks now writes only the new values. 

In our tests on a 50 GB table with 1,000 columns, adding a column and filling it in with Efficient Column Updates was 10x faster: 88 seconds instead of 15 minutes.

The problem: a new column rewrites the whole table

Tables for AI and ML development grow sideways: a feature someone wants to test, a quality score from a new labeling pass, embeddings from the latest model.

Adding an empty column has always been instant, but backfilling the values can take a long time due to a mechanism in open table formats called “copy-on-write”. The protocol used to require that data files stored all of its columns together, so putting values into the new column means writing each file again in full, images, text, old embeddings and all. 

This has 3 major implications:

Rewrite data that didn't change: Adding one column to a table with a thousand takes about as long as rewriting all thousand.

Automated research becomes impractical / expensive: An agent improves a model by trying an idea, checking the result, and trying again. When every try rewrites the whole table, the agent spends its time and your compute budget on rewrites instead of experiments.

Workarounds become brittle to maintain: Teams keep new columns in side tables, or copy their data into a separate system, and then have yet another thing to keep in sync and secure.

The larger your table gets, the more each experiment costs, and the fewer ideas your team is able to try.

Introducing Efficient Column Updates

When you fill in a column, Databricks now saves the new values in a sidecar file next to each existing data file and leaves the existing files alone. Query results are unchanged, because the engine is able to stitch the two files together at read-time. 

Fast update speed: Only the new values are written, so a small change stays a small job no matter how big the table gets.

Familiar SQL syntax: Add columns with ALTER TABLE and fill them with UPDATE. If Databricks can't take the fast path for a particular update, it runs a standard update and you get the same result.

One copy of your data: Experiments happen on the same Unity Catalog managed table the rest of your work reads, allowing for unified governance and consistent guardrails

Now, even as your table gets larger, the cost of experimentation remains constant, allowing your team to try as many ideas as desired.

Benchmark: adding a feature to a wide, 1,000-column table

On a 50 GB table with 6 million rows and 1,000 columns, a standard update took 15 minutes. With Efficient Column Updates it took 88 seconds, a 10x improvement.

How to use efficient column updates

Say a team trains a click-through-rate model on a main.recsys.ctr_features table that holds hundreds of user and item features. A researcher wants to test one more: each user's click rate over the last 30 days.

1. Turn it on for the table. A workspace admin first enables Efficient Column Updates on the Previews page. Then set one table property:

2. Add the column and fill it in.

The engine computes the new feature and writes only user_ctr_30d.

3. Train with it. The new column works like any other: query it, check it, and add it to your model's feature list. If it doesn't help, try the next idea (or get an agent to). 

Efficient Column Updates is available in Beta for Unity Catalog managed Delta tables on Databricks Runtime 19 and above. Iceberg support is coming soon: we are working with the open source community to add this capability to the Apache Iceberg™ spec.

Enable the Beta in the workspace previews page

What are Efficient Column Updates?

Efficient Column Updates is a Delta Lake table feature on Databricks, in Beta. When you add a column and fill it in, Databricks writes only the new values and doesn't rewrite the columns that didn't change.

How does Efficient Column Updates make adding a column faster?

A standard update writes every affected data file again in full. Efficient Column Updates saves the new values in separate small files and leaves the existing files alone, and queries read both together as one table. The update still reads its inputs and computes the new values. What it skips is the rewriting.

Do I need to change my SQL to use Efficient Column Updates?

No. You add a column with ALTER TABLE ... ADD COLUMN and fill it in with UPDATE.

Which tables can use Efficient Column Updates?

Unity Catalog managed Delta tables, read and written with Databricks Runtime 19 or above. The table needs catalog commits, row tracking, deletion vectors, and column mapping in id mode, which must be set when the table is created. Iceberg support is coming soon as we collaborate with the open source Iceberg community to add it to the Apache Iceberg spec.

Can I turn Efficient Column Updates off?

Yes. Set the table property to false to stop writing new column files, then run REORG TABLE ... APPLY (PURGE) to fold the existing ones back into the data files. Your values are preserved. The table still requires Databricks Runtime 19 or above afterward, and DROP FEATURE isn't supported in the Beta, so try it first on tables that aren't critical.

Get the latest posts in your inbox

原文为英文,正文由自动抓取并保留原文。

本文由采集器自动同步

原文发布于 Databricks Blog(Efficient column updates: add and update columns 10x faster),标题、摘要与正文由机器翻译,术语按行业惯例统一,未经人工逐句校订。

阅读原文 ↗