Skip to content

如果你今天不归档……

另有 19 种语言版本

English · Español · 日本語 · Português (Brasil) · Français · Deutsch · Italiano · 한국어 · Português (Portugal) · 繁體中文 · Bahasa Indonesia · Türkçe · Polski · Tiếng Việt · ไทย · Українська · Español (México) · Français (Canada) · Deutsch (Schweiz)

A records room seen down its length: files in use in front, rows of archive boxes behind, and a shredder with a full bin at the far end.
图片由 AI 生成

第 4 个模块,共 4 个,属于 Data Architect 课程第 7 章为规模而设计。每个模块都可以单独阅读。 上一篇:当数据量遇上共享模型 · 下一篇:下一章查询与检索架构

**本模块回答的问题:**如何规划归档和清除?

When somebody tells me “we’ll archive the old records later,” I ask one question: if you’re not archiving today, are you ever going to archive? “Later” often becomes after the next release, after the migration, after the reorganization, after we fix performance, after we run out of storage. Then five years on, someone finally asks why there are 80 million records in this object. I don’t want to discover archiving after large data volume has become the problem. If I know the data will grow, I decide its lifecycle when I design it. Salesforce’s own guide says the same: “if your volume of data is increasing, performance can degrade as time goes by. A policy of archiving or discarding data at the same rate at which it comes into the system can prevent this effect” (Best Practices for Deployments with Large Data Volumes (在新标签页中打开), Winter ‘27). ⟲

我们已经问过一条记录是怎么创建的、归谁所有、谁能改它、什么是权威的。现在再加一个:**它怎么离开?一条记录可能从活动到非活动,到归档,再到清除。**并不是每条记录都需要经历每个阶段,但每个大数据量对象都需要一个生命周期。Steve Trucking 的一次配送在进行中时一直被需要:配送小组、调度员、客服、合作伙伴、自动化都要用它。完成一周后,它仍然有用。六个月后,它主要是服务历史。三年后,主要用于分析、审计或偶尔的争议。十年后,也许已经没人有正当理由保留它了。数据的价值随时间变化;架构也应该随之变化。

删除不可避免,所以在第一天就决定

Section titled “删除不可避免,所以在第一天就决定 ”

总有一天你确实需要删除数据。所以我要求保留和清除策略在项目一开始就定下来,而不是等存储变贵的时候。保留由业务和监管要求驱动:它要保持运营状态多久,我们必须保留它多久,为什么,谁可能需要它,他们需要多快拿到,它最终能不能走,隐私是否要求它更早走?第 5 章说明了永远保留一切并不自动更安全;有时保留数据更久本身就是风险。

把三个决定分开。**保留:**我们保留它多久?**归档:**那些已经不属于活动工作负载的数据,我们放在哪里、怎么保留?**清除:**什么时候、怎么永久删除?需要七年的数据,不意味着七年都保持活动。也许是十八个月活动,然后在剩余期间归档,然后清除。这样生命周期就明确了。

Purging at volume has its own mechanics, and Salesforce spells them out. Deleting a record doesn’t remove it at once: it goes to the Recycle Bin for 15 days, and while it’s there it “still affects database performance because the data is still resident, and deleted records have to be excluded from any queries.” For a purge of a million records or more, Salesforce’s advice is the hard delete option of Bulk API 2.0, which skips the Recycle Bin, and when records have many children, to delete the children first (Deleting Data (在新标签页中打开); Best Practices: Deleting Data (在新标签页中打开)). A purge is a data operation like any other at scale: plan it, run it in batches, and check it. ⟲

Test knowledge. Know how to purge at volume: soft-deleted records stay in the Recycle Bin for 15 days and still slow queries; for a million records or more, use Bulk API 2.0 hard delete; delete children before parents. ⟲

Every record has a way out Every record has a way out, in four numbered stages. One, active, the operational work: it lives in the core org, and the operational window ends it, for example after 18 months. Two, inactive, occasional service: still in the core org, read and rarely changed, until the archive run. Three, archived and still findable: in big objects, through Salesforce Connect or in Archive, and found from Salesforce, until the retention requirement ends, for example 7 years in all. Four, purged, gone for good: it lives nowhere; permanent deletion is set on day one, with backups in place first. Underneath: retain for seven years doesn't mean keep active for seven years. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.34.0", "built": "2026-10-20", "id": "DGM-DA-LDV-41", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "comparison 0.4.0", "theme": "stevetecharc 1.4.0"} 1 Active the operational work LIVES In the core org ENDS BY The operational window e.g. 18 months 2 Inactive occasional service LIVES Still in the core org Read, rarely changed ENDS BY The archive run 3 Archived and still findable LIVES Big objects, Salesforce Connect or Archive Found from Salesforce ENDS BY The retention requirement e.g. 7 years in all 4 Purged gone for good LIVES Nowhere DECIDED BY Permanent deletion, set on day one Backups in place first Retain for seven years doesn't mean keep active for seven years. © 2026 Twinshark LLC · stevetecharc.com
点击放大

Retain for seven years doesn’t mean keep active for seven years. ⟲

归档最终意味着把记录从活动系统中删除,所以在设计删除之前,我要先有恢复方案:我们能恢复吗,多快,我们确切知道删了什么吗,能恢复关系吗,测试过吗?**在删除任何东西之前,先把备份做好。**备份和归档是不同的能力:备份防止丢失;归档有意把数据移出活动数据集,同时保留业务仍然需要的访问。误删十条记录很烦人。误删一千万条就是一次事故。“零的个数”也适用于错误。

现在两者都由 Salesforce 自己提供。OwnBackup 背后的公司 Own 已经成为 Salesforce Platform 的一部分:Own Recover 现在是 Salesforce Backup & Recover(每日和按需备份数据和元数据,在字段、记录或对象级别恢复,按时间点恢复),而 Archive 按照归档和保留策略,把很少使用的数据移到低成本存储,同时仍可在 Salesforce 内部访问(Own From Salesforce Product Suite FAQ (在新标签页中打开);Own’s tools, now part of Salesforce (在新标签页中打开))。

没人找得到的归档,几乎就是删除

Section titled “没人找得到的归档,几乎就是删除 ”

一个团队把旧数据移到了更便宜的地方。归档完成。然后一位客户打来电话:“我四年前有一次配送,现在需要送达证明。”客服在 Salesforce 里搜索:什么也没有。现在他们需要另一个系统、正确的表、一个标识符、一位管理员、一个申请,外加两天时间。这算不上什么归档。归档数据不必表现得像活动数据。它可以更慢、只读、显示在不同的组件里。但归档数据必须按业务的要求保持可查找。

I’ve seen this done well at a service chain. At the very beginning of the project they told me, “We only do a hundred appointments a day at a store.” A hundred, no big deal. But they had a thousand stores, open six days a week. Do the quick math: that’s about 31 million appointments a year. Then they created two appointment records for every visit, one at the front office and one at the back, so 62 million. And they needed five years: over 300 million records. I could see large data volume coming before we’d even gone live. So right from the beginning we said: there has to be archiving before we collect a single appointment. We put the archive in big objects and built it in from the ground up. When a user searched a customer, the live appointments came first, and below them, the archived ones. The archive didn’t pretend to be active data, and nobody had to become a database administrator to find history. Active data where the operational system needs it; archived data somewhere suited to its volume; a path from the business context to both. Much better than either extreme: everything active forever, or moved somewhere nobody can find. ⟲

Keeping data in core is like keeping it at the front of the office, where it’s in the way of today’s work. Somewhere in the future of any object with tens of millions of records there’s a move to the back: a box in an archive, the shed (big objects), or a hologram (virtualization, the data shown in Salesforce but living elsewhere). There’s no single answer; I choose the destination by constraint. When the customer doesn’t want an external store, I’ve used big objects: on-platform, built for very large volumes, but with no standard UI or reporting, Apex-only access and querying through the index, so plan the access path before you choose them (chapter 3’s “shed out back”). Plan the storage too: most editions are allocated storage for 1 million big object records per org, and more has to be arranged with Salesforce (Data and File Storage Allocations (在新标签页中打开)). Two more facts matter for an archive. Big objects support only object and field permissions, not sharing rules, and triggers and flows don’t run on them. And inserting an identical record twice creates only one, so writes can be idempotent, which helps when an archive run has to restart (Big Objects (在新标签页中打开)). ⟲

An archive in a big object Two zones, Inside Salesforce and Outside Salesforce, with a dashed boundary between them. Inside, a Work Order (WorkOrder, active) has an arrow labelled archive job to a Work Order Archive, a big object (__b), also inside Salesforce. Below, an Archive viewer, a Lightning web component, has an arrow labelled reads through Apex to the Work Order Archive. The outside zone is empty. Underneath: it stays inside Salesforce, but with no standard page: users see it through a component that reads it with Apex; no sharing rules, triggers or flows. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.36.0", "built": "2026-10-20", "id": "DGM-DA-LDV-44", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "boundary 0.1.0", "theme": "stevetecharc 1.4.0"} INSIDE SALESFORCE OUTSIDE SALESFORCE Work Order WorkOrder, active Work Order Archive big object (__b) Archive viewer Lightning web component archive job reads through Apex Stays inside Salesforce, but with no standard page: users see it through a component that reads it with Apex. No sharing rules, triggers or flows. © 2026 Twinshark LLC · stevetecharc.com
点击放大

A big object: the archive stays inside Salesforce, and you build the window users see it through. ⟲

When an external store is fine, I’ve used an off-platform database surfaced through Salesforce Connect, so archived records appear in Salesforce without being copied back. Precisely: Salesforce Connect reaches external data through OData services, other Salesforce orgs, a custom adapter built with the Apex Connector Framework, or specific adapters for Amazon DynamoDB, GraphQL and SQL (the SQL adapter supports Snowflake and Amazon Athena), so a general database usually needs an OData layer or a custom adapter in front of it (Choose Which Salesforce Connect Adapter to Use (在新标签页中打开)). ⟲

An archive outside, through Salesforce Connect Two zones, Inside Salesforce and Outside Salesforce, with a dashed boundary between them. Inside, a Work Order (WorkOrder, active) has an arrow labelled archive job that crosses the boundary to an Archive database outside Salesforce (or other low-cost storage). Also inside, Archived Work Orders, an external object (__x), has an arrow labelled Salesforce Connect pointing to the same database. Underneath: the records live outside; Salesforce Connect shows them in Salesforce as an external object, read when someone asks, not copied back. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.36.0", "built": "2026-10-20", "id": "DGM-DA-LDV-45", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "boundary 0.1.0", "theme": "stevetecharc 1.4.0"} INSIDE SALESFORCE OUTSIDE SALESFORCE Work Order WorkOrder, active Archived Work Orders external object (__x) Archive database or other low-cost storage archive job Salesforce Connect The records live outside. Salesforce Connect shows them in Salesforce as an external object, read when someone asks, not copied back. © 2026 Twinshark LLC · stevetecharc.com
点击放大

An external store: the archive leaves Salesforce, and Salesforce Connect brings it back into view. ⟲

The archive doesn’t have to be a database. It can be files in low-cost file storage, such as Amazon S3, and Salesforce Connect’s SQL adapter for Amazon Athena lets users “analyze data directly in Amazon Simple Storage Service (Amazon S3)” from Salesforce. One catch for an archive: that adapter is available “not for high-data-volume external objects,” so check what your volume needs before you choose it (Salesforce Connect SQL Adapter for Amazon Athena (在新标签页中打开)). ⟲

An archive in file storage, through Salesforce Connect Two zones, Inside Salesforce and Outside Salesforce, with a dashed boundary between them. Inside, a Work Order (WorkOrder, active) has an arrow labelled archive job that crosses the boundary to File storage outside Salesforce, such as Amazon S3. Also inside, Archived Work Orders, an external object (__x), has an arrow labelled Salesforce Connect (Amazon Athena) pointing to the same file storage. Underneath: the records live as files outside; Salesforce Connect's Amazon Athena adapter queries them where they sit and shows them in Salesforce as an external object. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.36.0", "built": "2026-10-20", "id": "DGM-DA-LDV-46", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "boundary 0.1.0", "theme": "stevetecharc 1.4.0"} INSIDE SALESFORCE OUTSIDE SALESFORCE Work Order WorkOrder, active Archived Work Orders external object (__x) File storage such as Amazon S3 archive job Salesforce Connect (Amazon Athena) The records live as files outside. Salesforce Connect's Amazon Athena adapter queries them where they sit and shows them in Salesforce as an external object. © 2026 Twinshark LLC · stevetecharc.com
点击放大

File storage: the same move, with files in place of a database. ⟲

And now Salesforce’s Archive is the built-in option, keeping archived records reachable from Salesforce. Third-party tools such as GRAX are in the market too. ⟲

Test knowledge. Know the archive destinations and what big objects are: built for very large volumes (consistent performance from a million records to a billion); reached through Apex, APIs and their index, not the standard UI; object and field permissions only, no sharing rules; no triggers or flows. Know the alternatives: an external store through Salesforce Connect, and Salesforce’s Archive. ⟲

产品不是重点。特征才是:数据有多少,多久被检索一次,需要多快呈现,是否需要关系型访问,用户是否必须从 Salesforce 里找到它,能否只读,谁可以看,保留多久,成本多少,以及最终怎么清除。这些答案决定技术。还要记住:**数据物理上放在哪里,和用户在哪里能发现它,是两个不同的问题。**五年前的配送不属于活动对象。这不意味着客服不应该能找到它。

When I’m moving large volumes out of an operational system, I don’t like copy, then delete in one step. There’s too much trust in it. And before the first real run, I rehearse it: a dry run that shows which records would move, ideally in a full copy sandbox, deleting nothing. Salesforce’s Archive app lets you preview an archive policy before you publish it (Archive App (在新标签页中打开)), and other archiving tools offer a dry-run mode for the same reason. Then I use three steps: ⟲

  1. Copy and flag. Copy the records to the archive and mark them in the source as pending archive. Don’t delete anything yet. Now both copies exist. On the service chain, this was a batch that ran on the weekend. ⟲
  2. Verify. Re-query the source and the archive and prove the archive is right: counts, identifiers, relationships, totals or other reconciliation; can we retrieve them? For extra assurance, add checksums, or restore a sample back and compare it. Then flag them as validated. Trust but verify. Users still find the records in the source, because they aren’t archived yet. ⟲
  3. Delete and flip. Only after verification, and only for records that aren’t under a legal hold, delete the active records and mark the archive complete, so the search screens now pull them from the archive. The deletion doesn’t have to follow at once; it could happen a week later. ⟲

What could go wrong with one pass, copy and delete? It didn’t copy, and you’ve deleted the records. The point is that you don’t cross the destructive boundary until you’ve proved the copy. And with the states, you can report on every archive run. ⟲

This isn’t just my habit; it’s how the serious archiving tools work. Oracle’s archive and purge, for example, validates the records, copies them to archive tables, and then purges from what it archived, with a restart program for when a run fails partway (Archive and Purge (在新标签页中打开)). Tools that copy and delete in a single pass come with a warning to test with a dry run first (AWS Prescriptive Guidance: Archiving data from unpartitioned tables (在新标签页中打开)). Salesforce’s Archive app respects legal holds: records under a legal hold can’t be deleted or removed (Archive App). ⟲

Copy, verify, then delete and flip Copy, verify, then delete and flip, in three lanes: people searching (care agents and the search screen), the Salesforce objects holding the active records, and the big object archive, the shed. Steps 1 and 2, copy: the records are copied from Salesforce to the archive in a weekend batch, and flagged in Salesforce as pending archive. Steps 3 to 6, verify: the source is re-queried, the archive is re-queried, the counts and IDs match, and the records are flagged validated; a search still finds them in the source. Step 7, delete and flip, maybe a week later; step 8, a search now finds them in the archive. Underneath: the destructive boundary is step 7; every state is recorded, so a failed run restarts where it stopped. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.34.0", "built": "2026-10-20", "id": "DGM-DA-LDV-42", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "system-landscape/lanes 0.11.0", "theme": "stevetecharc 1.4.0"} COPY, VERIFY, THEN DELETE AND FLIP People searching care agents, the search screen Salesforce objects Big object archive the shed copy, in a weekend batch 1 flag: pending archive 2 verify: re-query the source 3 re-query the archive; counts and IDs match 4 flag: validated 5 search: still found in the source 6 delete and flip, maybe a week later 7 search: found in the archive 8 Copy (1-2), verify (3-6), delete and flip (7). The destructive boundary is step 7. Every state is recorded, so a failed run restarts where it stopped. © 2026 Twinshark LLC · stevetecharc.com
点击放大

Don’t cross the destructive boundary until you’ve proved the copy. ⟲

还要把它设计成可以重启。归档 2,000 万条记录,作业在第 14,382,711 条记录处失败。如果答案是“从头再来”,我就不喜欢这个设计。大型操作会失败:连接中断、作业超时、一条古怪的记录抛出错误。流程必须知道哪些已经成功,这正是归档状态(待处理、已验证、已归档、失败)的用途,这样它才能重启,而不会重复数据、丢失数据,或删除尚未安全归档的东西。在规模上,可重启性是可靠性的一部分。

One more thing to know before you call a purge done: deleting the active records isn’t the same as erasing the data. Backups, caches, replicas and analytics copies may still hold it. That’s fine for an archive, and it’s exactly what chapter 5 asks you to account for when privacy law says the data must go. ⟲

归档可能成为逃避删除决定的借口。“说不定哪天会用到。”也许不会。第 5 章问的是**我们被允许保留它吗?**这一章加上一句:**让它保持活动有价值吗?**有些记录移到归档;有些被汇总,有些被匿名化,有些被删除。目标不是保存每一个字节。而是在业务正当需要的期间,保留业务正当需要的东西。

Unstructured data is a different scale problem. Steve Trucking expects four to five million photos a year. Purely for magnitude, at about 4 MB a photo, five million is about 20 TB in one year, before growth. The real size will vary; the zeros tell you the binary content needs its own architecture. That’s why Checkpoint 1 separated the business record about a photo from the photo itself. Salesforce may need the photo’s type, its delivery, when and by whom it was taken, where it’s stored and its retention state, or even just a count and a “required photos complete” flag. The image belongs in storage built for millions of large objects. It’s the same principle as FleetLink’s GPS: keep in core what the operational process needs, and don’t copy every high-volume artifact into core because Salesforce takes part in the process. ⟲

Data leaving the active object doesn’t leave its security requirements behind. Redrock saw only Redrock’s deliveries while they were active; archive them, and Redrock still doesn’t get Keystone’s history. The archive needs an authorization model too, for Recipient personal data, photos, financial data, service history and agent access. A big-object archive doesn’t help on its own here: big objects don’t support sharing rules, so the access path you build has to carry the partner boundary. One design question for every archive: how do the original security requirements survive the move? The implementation may change; the requirement doesn’t. ⟲

一位收货人问智能体:“四年前我的冰箱送到哪里了?”答案存在,但已经归档了。智能体应该能触及它吗?我的立场:**这是一个重大决定,而且应该由业务来做。**架构师列出选项以及每个选项的代价:哪个归档,智能体如何触及,延迟,消耗,智能体可以就旧数据说些什么,以及保留和隐私方面的限制。然后由业务决定。如果归档数据应该保持可触及,就建一条经过授权的检索路径。如果不应该,就让归档边界来强制执行。我不希望的,是技术在无意中替你做了这个决定。

**考试之外:AI 改变了什么。**归档现在包括一个上下文决定:历史是否对智能体保持可触及。归档不会仅仅因为数据仍然存在,就自动成为智能体上下文的一部分。把这个决定交给业务,然后应用与人工访问相同的授权和保留规则。

Steve Trucking:在需要之前决定生命周期

Section titled “Steve Trucking:在需要之前决定生命周期 ”

按五年算:大约 **900 万个工作订单、1,450 万个行项目,**几百万张照片,还有我们有意放在核心之外的状态历史和 GPS。我不希望 Steve Trucking 等到第五年才决定“旧”是什么意思。具体的期限现在可能还没定;没关系。但架构应该已经在问:一次已完成的配送保持运营状态多久?客服必须马上看到哪些细节?工作订单和它们的行项目什么时候移到归档,移到哪里?哪些历史属于 Snowflake?旧照片放在哪里,什么时候删除?零售合作伙伴还能看到哪些归档记录?智能体能触及已归档的配送吗?这些不是清理问题。它们是架构问题。

对每一个大数据量对象,我要五个答案。**它什么时候不再活动?它去哪里?我们如何证明它到了那里?之后别人怎么找到它?它最终什么时候被删除?**如果你回答不了这些,你就没有归档策略。你只有一个希望。

The Archive Test The Archive Test, five questions for three Steve Trucking objects. When does it stop being active? The work order after the claims window; the line item with its work order; the proof-of-delivery photo after the claims window. Where does it go? The work order to an archive found from Salesforce; the line item with its work order; the photo stays in photo storage, in a colder tier. How do we prove it got there? Counts and IDs reconciled for the work order; counts per work order for the line items; a file count, and the link still opens, for the photo. How is it found afterward? Care agents search, with the archive below the live results; the line item from its work order; the photo from the archived work order. When is it finally deleted? The work order at the end of retention, on the partner's schedule; the line item with its work order; the photo at the end of retention, or sooner for images of people's homes. Underneath: if you can't answer all five, you don't have an archive strategy; you have a hope. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.34.0", "built": "2026-10-20", "id": "DGM-DA-LDV-43", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "system-landscape/inventory 0.11.0", "theme": "stevetecharc 1.4.0"} THE ARCHIVE TEST WORK ORDER LINE ITEM PROOF-OF-DELIVERY PHOTO When does it stop being active? After the claims window With its work order After the claims window Where does it go? An archive found from Salesforce With its work order Stays in photo storage, a colder tier How do we prove it got there? Counts and IDs, reconciled Counts per work order File count, and the link still opens How is it found afterward? Care agents search; archive below live From its work order From the archived work order When is it finally deleted? End of retention, on the partner's schedule With its work order End of retention, or sooner for people's homes If you can't answer all five, you don't have an archive strategy. You have a hope. © 2026 Twinshark LLC · stevetecharc.com
点击放大

Five answers, or you have a hope. ⟲

  • 每个大数据量对象的活动、归档、保留和清除生命周期,在存储或性能逼你之前就决定好。
  • 在任何破坏性的归档或清除之前,必须先有哪些备份和恢复能力。
  • 归档数据放在哪里(big object、通过 Salesforce Connect 访问的外部存储、Salesforce 的 Archive),依据是数据量、检索、延迟、安全、成本和删除。
  • 在记录跨越删除边界之前,如何验证归档运行,并让它可以重启。
  • 哪些非结构化内容放在核心之外、而它的业务记录留在 Salesforce 中,以及归档数据是否对智能体保持可触及。

我们花了很多时间研究数据如何进入一个系统:API、导入、集成、迁移、用户、智能体。也要花同样多的时间研究它如何出去,因为我们今天创建的数据,就是明天的大数据量问题。归档也许三年后才开始。生命周期现在就应该存在。设计入口的时候,就设计出口。