合併每小時附加寫入所留下的小檔案

閱讀約需 41 分鐘 分鐘,9 節 中共有 3 個範例。

版次 2026.11.10 範例於 2026年11 月 20 通過測試 39 個範例中有 39 個通過 變更內容

由 AI 翻譯。經人工以英文驗證。 我們如何製作書籍

譯自英文書,版次 2026.11.10。 閱讀原文

本章說明如何計算一個資料表所含的資料檔案數量,如何在 Delta Lake、DuckLake 與 Iceberg 中將這些檔案合併為較少的檔案,以及每次合併後磁碟上留下了什麼。問題出在載入作業上。第一章中的 pageviews 資料表,每小時會分別載入三種格式中各一次。每次載入就是一次提交(commit),而每次提交都會寫出自己的資料檔案。資料檔案是指存放資料表資料列的 Parquet 檔案。

每小時附加寫入會留下小檔案

最近一次變動於第 2026.11.10 版

每一次附加資料列的提交(commit),至少會寫出一個資料檔案。一張每小時載入一次的資料表,一天會累積 24 個資料檔案,每個檔案存放一小時的資料列,每小時約有 500 個資料列。查詢必須開啟所有未被篩選條件略過的檔案,而每次開啟檔案都要耗費時間。資料表的中繼資料(metadata)也會隨著列出的檔案增加而變大,因為每種格式都會為目前版本所使用的每個資料檔案保存一筆記錄。因此,即使資料列的總數不多,大量的小檔案仍會增加讀取與查詢規劃的成本。

檔案數量是需要留意的數字,因為它會隨時間增加。檔案大小同樣重要,但本書不印出檔案大小,因為以位元組(byte)表示的大小在每次執行之間都會變動。計算檔案數量也是檢驗壓縮合併是否有效的可靠做法:壓縮合併前後,資料列應該相同,檔案數量則應該減少。

解決辦法是壓縮合併(compaction)。壓縮合併會把許多小型資料檔案重寫成較少、較大的檔案。壓縮合併和其他提交一樣,會寫出取代用的檔案,把它們列入中繼資料,並且只要資料表的歷史紀錄仍然參照舊檔案,就會讓舊檔案繼續留在磁碟上。舊檔案何時可以移除,請見第 7 章。

三種格式各有不同的呼叫方式。下表列出各格式對本章建立的六個每小時檔案做了什麼。

格式 呼叫 合併前的檔案數 合併後的檔案數
Delta Lake optimize.compact() 6 1
DuckLake ducklake_merge_adjacent_files 6 1
Iceberg table.overwrite(table.scan().to_arrow_batch_reader()) 6 1

表中的數字都是各範例實際印出的結果。每個範例都把切分範圍內的六個小時資料,以每小時一次載入的方式,載入沒有分區的資料表,因此每種格式一開始都是每次載入一個資料檔案。第 4 章的分區資料表則會有不同的表現,因為在支援分區壓縮合併的格式中,每個分區是各自獨立壓縮合併的。本章讓資料表維持不分區,使檔案數量只有單一成因。

DuckLake 的數字還需要多一項設定才有意義。這裡每小時的載入各約有 500 筆資料列,高於第 1 章所說的內嵌(inlining)資料列上限,所以預設行為仍會把它們寫成檔案。不過 DuckLake 的範例在連接(attach)時仍然關閉內嵌,也就是該章說明的那項設定,這樣檔案數量就不會取決於每次載入碰巧有多少資料列。

實用原則: 每次載入後,計算每張資料表的資料檔案數量,並依據檔案產生的速度,以及讀取端所需的檔案大小,來安排壓縮合併的排程。每小時載入一次,每張資料表一天會有 24 個檔案,因此每天壓縮合併一次是合理的初始選擇。這只是粗略的經驗值,而不是測量的結果。只有當你自己的讀取時間或檔案數量顯示有需要時,才提高壓縮合併的頻率。

以 optimize.compact() 壓實

最近一次變動於第 2026.11.10 版

Delta Lake 是上表三種格式中的第一種。其 deltalake 函式庫(Python library)將壓實操作掛在資料表的 optimize 屬性上。它的 compact() 方法會把資料表中小型資料檔重寫為較大的檔案,並回傳一個含有各項指標的字典。字典中包含新增與移除檔案的數量,以及本書不會印出的大小欄位。

你先把這六個小時的資料載入一個 Delta 資料表,每小時各附加一次,然後計算資料表列出的檔案數,執行壓實,再計算一次。每次計數都來自資料表針對其目前版本所列出的檔案清單。

file-counts-before-after.py Python 3.12.15 · deltalake 1.6.6 · duckdb 2.0.0 · pyarrow 26.0.1 · pyiceberg 0.12.0 通過
"""Load six hourly appends into a Delta Lake table, compact it, and count its files and rows before and after.The point rests on the file-count lines, and on the row count read from the version before the compaction."""from deltalake import DeltaTable, write_deltalakefrom lib.lakehouse import delta_file_count, new_warehouse, read_cut_hour, read_deltadef main():    with new_warehouse() as wh:        path = str(wh.root / "delta" / "pageviews_hourly")        for hour in range(6):            write_deltalake(path, read_cut_hour(hour), mode="append")        table = DeltaTable(path)        version_before = table.version()  # the version the read at the end goes back to        print(f"files before compaction: {delta_file_count(table)}")  # counts the files this version lists, not the disk        metrics = table.optimize.compact()  # a dict; numFilesAdded and numFilesRemoved are the two counts printed below        print(f"files added by compaction: {metrics['numFilesAdded']}")        print(f"files removed by compaction: {metrics['numFilesRemoved']}")        table = DeltaTable(path)        print(f"files after compaction: {delta_file_count(table)}")        print(f"rows after compaction: {len(read_delta(path))}")        before = read_delta(path, version=version_before)        print(f"rows at the version before compaction: {len(before)}")        parquet = list((wh.root / "delta").rglob("*.parquet"))  # every file on disk, including ones the current version dropped        print(f"parquet files on disk after compaction: {len(parquet)}")if __name__ == "__main__":    main()
輸出python file-counts-before-after.py
files before compaction: 6
files added by compaction: 1
files removed by compaction: 6
files after compaction: 1
rows after compaction: 2999
rows at the version before compaction: 2999
parquet files on disk after compaction: 7

壓實改變的是檔案,而不是資料列。呼叫之前,資料表列出 6 個資料檔;呼叫之後則列出 1 個。讀取目前版本會回傳 2999 列,與壓實前的資料列相同,只是分佈在較少的檔案中。

呼叫所回傳的指標,則從函式庫的角度統計了同一項變動:新增 1 個檔案,移除 6 個檔案。

壓實並沒有真正刪除舊檔案。若讀取呼叫之前的版本,資料表仍會回傳全部 2999 列,因為該版本仍指向舊檔案。呼叫之後,目錄中有 7 個 Parquet 檔案,即六個舊檔案加上一個新檔案。Delta Lake 會在另一個稱為 vacuum 的步驟中,移除不再被任何保留版本使用的檔案,這個步驟將在第 7 章說明。在該步驟執行之前,壓實只會增加磁碟上的檔案,而不會減少。

這裡的 Delta 讀取是透過函式庫的查詢建構器進行,本書中所有 Delta 讀取皆是如此。由於重點在於檔案數,資料列僅以筆數進行比較。

實用原則: 依第一節所述的排程壓實 Delta 資料表(每小時載入的資料就每日壓實一次),並在事後檢查檔案數。在移除任何檔案之前,請先閱讀第 7 章的保留規則:壓實會新增一次提交,並保留舊檔案不動,因此在 vacuum 執行之前,它只會增加儲存空間的用量。

DuckLake 中的壓縮合併

DuckLake 提供壓縮合併(compaction)作為維護函式,可直接從 SQL 呼叫。這個函式只需呼叫一次,並會針對它所合併的每個資料表傳回一列,說明它做了什麼。下一部分會說明這個函式,以及它會略過的一種情況。

此部分尚未翻譯,因此以英文呈現。

Merge adjacent files

最近一次變動於第 2026.11.10 版

ducklake_merge_adjacent_files takes a catalog, and optionally a table name and a schema name, which the call needs when the table is not in the main schema. Without a table name it merges the files of every table. The DuckLake documentation says the function can "merge multiple Parquet files into a single Parquet file that holds data inserted by multiple snapshots" (DuckLake documentation: Merge Files). The merge also works without expiring snapshots, and it does not delete the old files at once. Both points matter for the rest of this chapter. Because the merge does not expire snapshots, every older snapshot still refers to the old files.

What does the merge leave for a snapshot from before it? The example below reads one. It attaches the catalog with inlining off, inserts the six hours one insert each, and calls the merge once. The table lives in the wiki schema, so the call names it. It reads the snapshot number before the merge, so it can read the table as it was at that point.

compact-ducklake.py Python 3.12.15 · deltalake 1.6.6 · duckdb 2.0.0 · pyarrow 26.0.1 · pyiceberg 0.12.0 通過
"""Merge six DuckLake data files, then read a snapshot from before the merge to see what the merge left behind.The point rests on the data-file lines, and on the row count read at the earlier snapshot."""from lib.lakehouse import (    DUCKLAKE_ALIAS,    NAMESPACE,    TABLE,    connect_ducklake,    create_ducklake_table,    ducklake_file_count,    new_warehouse,    read_cut_hour,)def main():    with new_warehouse() as wh:        lake = connect_ducklake(wh.con)        create_ducklake_table(lake, wh.root)  # inlining is off here, so every insert writes a data file        table = f"{DUCKLAKE_ALIAS}.{NAMESPACE}.{TABLE}"        for hour in range(6):            lake.register("hour", read_cut_hour(hour))            lake.execute(f"INSERT INTO {table} SELECT * FROM hour")            lake.unregister("hour")        # the newest snapshot before the merge, which the read at the end goes back to        before = lake.execute(f"SELECT max(snapshot_id) FROM ducklake_snapshots('{DUCKLAKE_ALIAS}')").fetchall()[0][0]        print(f"data files before merge: {ducklake_file_count(lake, DUCKLAKE_ALIAS, TABLE)}")        # the schema is named because the table is not in main; the call returns one row        result = lake.execute(            f"CALL ducklake_merge_adjacent_files('{DUCKLAKE_ALIAS}', '{TABLE}', schema => '{NAMESPACE}')"        ).fetchall()        # the row's fields: schema, table, files merged, files created        print(f"files merged: {result[0][2]}")        print(f"files created: {result[0][3]}")        print(f"data files after merge: {ducklake_file_count(lake, DUCKLAKE_ALIAS, TABLE)}")        print(f"rows after merge: {lake.execute(f'SELECT count(*) FROM {table}').fetchall()[0][0]}")        old = lake.execute(f"SELECT count(*) FROM {table} AT (VERSION => {before})").fetchall()[0][0]        print(f"rows at the snapshot before merge: {old}")        # every Parquet file under the data path, including the ones the table no longer lists        parquet = list((wh.root / f"{DUCKLAKE_ALIAS}_data").rglob("*.parquet"))        print(f"parquet files on disk after merge: {len(parquet)}")if __name__ == "__main__":    main()
輸出python compact-ducklake.py
data files before merge: 6
files merged: 6
files created: 1
data files after merge: 1
rows after merge: 2999
rows at the snapshot before merge: 2999
parquet files on disk after merge: 7

The merge's result row says what it did: 6 files merged into 1 file. The table lists 1 data file afterwards, down from 6. The row also names the schema and the table, so a merge aimed at the wrong table shows before anything else is read.

The old snapshot still reads. A count taken at the snapshot before the merge returns 2999 rows, the same count the current table returns. The Parquet files on disk number 7, the six the inserts wrote and the one the merge wrote. The six old files stay on disk until the cleanup in chapter 7 removes them.

The merge skips a file that has a delete file attached. A delete file is a record of deleted rows, which DuckLake writes instead of rewriting the data file when rows are deleted. Chapter 5 writes delete files in DuckLake, so this limit applies there. The DuckLake documentation names ducklake_rewrite_data_files as the call that rewrites those files, and its default delete_threshold is 0.95, which rewrites a file only when that share of its rows is deleted (DuckLake documentation: Rewrite Files with Deletes). The default is a value you should choose for your own data, not accept without a look.

Working rule: Run ducklake_merge_adjacent_files after the inserts for a period are done, and read the file count it returns. A merge does not remove deleted rows, so for a table with delete files, call ducklake_rewrite_data_files with a delete_threshold that you chose for that table, and check the result.

重寫資料表以進行壓縮

最近一次變動於第 2026.11.7 版

在 pyiceberg 的鎖定版本中,Iceberg 的壓縮是以覆寫(overwrite)方式進行的重寫。本章重寫整張資料表,這適用於未分區的資料表。你先以掃描讀取資料表,再用掃描傳回的資料列覆寫該資料表。覆寫會把這些資料列寫成替換用的資料檔,而舊檔案則會從目前的快照中移除。這是本書中 Iceberg 唯一的壓縮途徑,也是為了彌補缺少的呼叫而採用的變通做法,下一部分會加以說明。

重寫的好壞,要看它留下了什麼。下方的檢查會讀取六次附加(append)與一次覆寫之後資料表的檔案與資料列,並讀取重寫之前的某個快照。

iceberg-rewrite-by-overwrite.py Python 3.12.15 · deltalake 1.6.6 · duckdb 2.0.0 · pyarrow 26.0.1 · pyiceberg 0.12.0 通過
"""Rewrite an unpartitioned Iceberg table by overwriting it with its own scan, then check its data files, its snapshothistory and a snapshot from before the rewrite. The point rests on the data-file lines and on the row count of snapshot 6."""from lib.lakehouse import (    create_iceberg_table,    iceberg_file_count,    new_warehouse,    read_cut_hour,    scan_arrow,    snapshot_labels,)def main():    with new_warehouse() as wh:        table = create_iceberg_table(wh)        for hour in range(6):            table.append(read_cut_hour(hour))        last_append = table.current_snapshot().snapshot_id  # the snapshot after the sixth append        print(f"data files before rewrite: {iceberg_file_count(table)}")        # a batch reader, so the rows are not all read into one Arrow table first        table.overwrite(table.scan().to_arrow_batch_reader())        print(f"data files after rewrite: {iceberg_file_count(table)}")        print(f"rows after rewrite: {len(scan_arrow(table))}")        # sorted by sequence number, which puts the snapshots in commit order        snapshots = sorted(table.snapshots(), key=lambda snapshot: snapshot.sequence_number)        # labels count up in commit order, so the sixth append is snapshot 6        labels = snapshot_labels([snapshot.snapshot_id for snapshot in snapshots])        operations = [snapshot.summary.operation.value for snapshot in snapshots]        print("snapshot operations in order: " + ", ".join(operations))        print(f"{labels[last_append]} rows: {len(scan_arrow(table, snapshot_id=last_append))}")        # every Parquet file in the warehouse, including those that only older snapshots still hold        parquet = list((wh.root / "warehouse").rglob("*.parquet"))        print(f"parquet files on disk after rewrite: {len(parquet)}")if __name__ == "__main__":    main()
輸出python iceberg-rewrite-by-overwrite.py
data files before rewrite: 6
data files after rewrite: 1
rows after rewrite: 2999
snapshot operations in order: append, append, append, append, append, append, delete, append
snapshot 6 rows: 2999
parquet files on disk after rewrite: 7

資料檔從 6 個減少為 1 個,而資料表的讀取者以相同的方式讀到相同的 2999 筆資料列,只是來自較少的檔案。這次重寫是一次提交(commit),並新增兩個快照。依提交順序,這些操作是六次 append,接著是 delete 與 append:delete 快照會從資料表中移除所有資料檔,append 快照則加入重寫後的檔案。目前的快照只移動一次,因此沒有讀取者會看到空的資料表,但歷史紀錄會保留這兩個快照。以這種方式刪除整個檔案,就是第 5 章所述 Iceberg 刪除作業的寫入時複製(copy-on-write)行為。

重寫之前的快照仍可讀取所有資料列。標籤依提交順序遞增計算快照,因此快照 6 是重寫之前的最後一次 append。以該快照讀取時,資料表仍會傳回 2999 筆資料列。磁碟上的 Parquet 檔案有 7 個:六個舊檔案,加上重寫所寫入的一個檔案。第 7 章說明如何使舊快照過期,並計算它們仍保留的內容。

**實用原則:**只有在重寫期間沒有其他寫入者提交到該資料表時,才以覆寫方式重寫 Iceberg 資料表。在未分區的資料表上,請像本範例一樣以串流方式讀取掃描結果。在已分區的資料表上,必須以 to_arrow() 讀取掃描結果,因此整個掃描結果必須能放進作業的記憶體。串流讀取器只能讀取一次:若提交失敗,下一次嘗試請建立新的讀取器。每次重寫之後,請檢查檔案數與資料列數,並在確認結果之前,保留重寫之前的快照。

此部分尚未翻譯,因此以英文呈現。

Why pyiceberg has no rewrite call

最近一次變動於第 2026.11.7 版

The pyiceberg API documentation lists overwrite among its table operations (PyIceberg API documentation). Its one sentence on compaction is in the note on fast appends, and it is about metadata: the page says that metadata compaction is planned. It says nothing about data files. Its only maintenance call is expire_snapshots, which chapter 7 covers. The source of pyiceberg 0.12.0, in pyiceberg/table/__init__.py, has no method that compacts or rewrites data files. Its write operations are append, overwrite, delete, upsert, dynamic_partition_overwrite and add_files. Every one except add_files writes data files, and add_files registers files that already exist and writes none. dynamic_partition_overwrite, and overwrite with an overwrite_filter, can replace the rows of one partition, so a partitioned table can be rewritten one partition at a time. A compaction is therefore a rewrite built from those operations.

The rewrite has a memory cost that the file counts do not show, and the way the scan is read decides it. table.scan().to_arrow() reads the whole current snapshot into one Arrow table in memory before the overwrite starts. The rewrite above passes table.scan().to_arrow_batch_reader() instead, and pyiceberg documents that a streamed overwrite is microbatched by write.target-file-size-bytes, so its memory stays bounded. Streaming works only on unpartitioned tables, which this chapter uses. A partitioned table has to be read with to_arrow(), so memory must hold all of its rows at once. The bound is pyiceberg's documented behaviour, not a measurement made here.

The rewrite also reads every file and writes every file, including the ones that were already large enough. A table whose files are mostly the right size gets no benefit from it. This is the reason to use it only when the file count has grown and the table fits in memory.

Working rule: Check the pyiceberg release notes at each upgrade for a compaction call, because a call would replace the overwrite rewrite in this chapter. Until then, treat the overwrite as a batch job, run it when no other writer is committing, and for a partitioned table budget memory for the whole scan.

在信任每次壓縮之前先檢查

最近一次變動於第 2026.11.7 版

本章的範例合計印出四項數值,這四項就是你在執行任何壓縮之後應該檢查的內容。第一項是資料表自身清單中的檔案數。第二項是目前版本的資料列數,這個數字必須與壓縮前的筆數一致。第三項是壓縮之前某個版本或快照的資料列數,這個版本仍必須能夠讀取。第四項是資料表位置底下的 Parquet 檔案數,這個數字應該比檔案數多出等待清理的舊檔案數。

前兩項檢查顯示壓縮確實完成了它所宣稱的工作,而且沒有更動任何資料列。第三項檢查顯示歷史紀錄依然可用,這對任何固定讀取較舊版本的讀取端都很重要。第四項檢查顯示壓縮在磁碟上留下了什麼。第一項與第四項來自不同的地方,本書的範例同時印出兩者,使不一致的情形能在輸出中被看見,而不會隱藏在單一數字裡。第四項的數字在 DuckLake 資料表是 7,在 Iceberg 資料表是 7,各自都比仍列在清單中的檔案多一個。通過前三項檢查的壓縮,不該為這樣的數字負責。多出來的檔案是第 7 章要清理的狀態。

每個函式庫都有自己的檔案清單。Delta 範例計算目前版本的 URI 數量,DuckLake 範例向其目錄詢問資料表的檔案,Iceberg 範例則計算資料表檔案檢視中的項目數。這三個數字都是從中繼資料讀取,因此不依賴目錄列表,而目錄列表是第二個來源。當兩者不一致時,請先停下來查明原因,再執行下一次壓縮。

檢查失敗時,請停止該工作,並保持資料表現狀。不要用第二次壓縮去修正第一次,因為每次執行都是一次提交,第二次執行會使歷史紀錄更難閱讀。請依序讀取資料表歷史中的各次提交,找出更動資料列數的那一次,再由此決定如何處理。趁資料表仍保有出錯之前的狀態時,比較容易檢視該狀態。

實用原則: 每次壓縮之後,都要將資料列數與壓縮前的筆數比較,並讀取壓縮之前的某個版本。更動了資料列數的壓縮是一項錯誤,必須先修正,才能在該資料表上執行其他任何作業。

正式環境中會出什麼問題

最近一次變動於第 2026.11.10 版

儲存空間會先增加,之後才縮減。 本章的每一次壓實(compaction)都會寫入取代用的新檔案,並把舊檔案留在磁碟上。檔案數量可以說明這一點。DuckLake 合併之後,資料表列出 1 個資料檔案,磁碟上卻有 7 個 Parquet 檔案;Iceberg 重寫之後,資料表列出 1 個,磁碟上有 7 個。若壓實之後沒有搭配過期處理的步驟,儲存費用會比壓實之前更高。請把過期處理與清理和壓實一併規劃,並在兩者都完成之後量測磁碟用量。徵兆是:每次執行後磁碟用量持續增加,而資料表的列數與檔案數卻維持不變。

已刪除的資料列會一直留著,直到重寫才會處理。 如合併一節所示,DuckLake 的合併會略過任何帶有刪除檔案的檔案。有刪除記錄的資料表若只做合併,這些檔案會維持原狀。請對它們使用 ducklake_rewrite_data_files,並自行選定門檻值。請在前後各量測一次列數,因為光看合併的結果,無法得知已刪除的資料列仍留在檔案中。請留意帶有刪除檔案的檔案數量,若在每次合併之後都維持不變,就是徵兆。

並行寫入者在此未經測試。 本章的範例一次只有一個寫入者,並未測試壓實與提交(commit)重疊的情況。請在自己的引擎上測試這種重疊;在取得測試結果之前,請把壓實排在沒有任何寫入者提交的時段。三者之中,Iceberg 的重寫最容易受影響,因為它會讀取整張資料表,再整份寫回。重疊失敗時,寫入者或壓實作業會回報錯誤,但本書並未重現過這類錯誤。

太頻繁會增加提交,太少則會拖慢讀取。 每一次壓實都是一次提交,每次提交都會增加中繼資料。每次載入後都壓實,會讓每次載入的提交數變成兩倍;每月只壓實一次,則會讓小檔案累積一個月。前者的徵兆是提交次數的成長速度超過載入次數,後者的徵兆是查詢時間隨檔案數增加而上升。這是需要在自己的資料表上量測的取捨,而不是範例所能證明的規則。

以數量為目標,並不等於以大小為目標。 單一的超大檔案,會讓讀取端可平行處理的工作變少,也讓依檔案層級統計資訊進行的裁剪(pruning)能略過的檔案變少。這些範例以檔案數量為目標,並未印出檔案大小。這是針對讀取端所做的判斷,應由讀取端的查詢時間來決定目標。若壓實產生單一的超大檔案之後,查詢時間反而變差,就是警訊。

實用原則: 壓實應與過期處理及清理排在一起,不要分開安排。每次執行之後,請做檢查一節中的四項檢查;若列數有變動,或並行寫入者發生失敗,就停止排程。

本章的決定

最近一次變動於第 2026.11.7 版
  • 每種格式都使用各自函式庫的呼叫方式,本章沒有任何範例使用 DuckDB 的 Iceberg 或 Delta Lake 擴充套件。讀取與寫入都透過 Python 函式庫以及 DuckDB 對 DuckLake 的支援來進行,因此每個計數都來自寫出該批檔案的工具。
  • DuckLake 範例在關閉資料內嵌的狀態下進行附加。關閉內嵌後,無論載入的資料量多大,每個計數算的都是檔案數。
  • 檔案數取自各函式庫自身的檔案清單。磁碟上的 Parquet 檔案數是第二道查驗,而且本章不會印出任何檔案大小。
  • 這些資料表沒有分割,因此每個計數只有一個成因:載入的次數。有分割的情況留待分割區演進那一章處理。
  • Iceberg 的壓實是以覆寫的方式重寫,因為 pyiceberg 0.12.0 沒有壓實的呼叫。這個重寫以串流方式進行掃描,pyiceberg 允許未分割的資料表這麼做。本章點出這個替代做法,以及有分割的資料表仍然存在的記憶體成本。
  • 本章不會讓任何快照過期,也不會移除任何檔案。第 7 章兩者都會處理,而本章的計數是那項工作的起點。
  • 實用原則中的排程只是起點。本書不宣稱存在最佳的間隔,因為合適的間隔取決於資料表的檔案抵達得多快,以及讀取端需要檔案有多大。

本章,於本版次中

版次 2026.11.10範例於 2026年11 月 20 通過測試本章 3 個範例 個範例中有 3 個通過

譯自英文書,版次 2026.11.10。

引用本節

格式

各種格式皆引用英文原書,本譯本即依循該原書。

每種格式都會標示本版。其連結會開啟目前版次,節標題會說明該節內文最後一次變動的時間。存取日期與擷取日期即為你開啟此頁的當日。

本頁內容

第 6 章,共 10 章: 合併每小時附加寫入所留下的小檔案

  1. 每小時附加寫入會留下小檔案
  2. 以 optimize.compact() 壓實
  3. DuckLake 中的壓縮合併
  4. Merge adjacent files
  5. 重寫資料表以進行壓縮
  6. Why pyiceberg has no rewrite call
  7. 在信任每次壓縮之前先檢查
  8. 正式環境中會出什麼問題
  9. 本章的決定

返回頂端所有章節