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、匯入、整合、遷移、使用者、代理程式。也要花同樣多的時間研究它如何出去,因為我們今天建立的資料,就是明天的大數據量問題。歸檔也許三年後才開始。生命週期現在就應該存在。設計入口的時候,就設計出口。