apache / apache/iceberg-python

Upsert gets slow on tables with many columns

オープン
#3,860 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
1.1k
フォーク
581
平均マージ
1日 17時間
マージ済み PR(30日)
78

説明

### Feature Request / Improvement

`upsert` compares the matched rows one cell at a time, so it gets slower with every extra column, not just with every extra row.

On a table with 200 columns, comparing 20k matched rows takes around 20 seconds on my machine, before anything is written.

To reproduce:

```python
import time
import pyarrow as pa
from pyiceberg.table.upsert_util import get_rows_to_update

rows, cols = 20_000, 200
table = pa.table({"pk": pa.array(range(rows)), **{f"c{i}": pa.array([float(i)] * rows) for i in range(cols)}})

start = time.monotonic()
get_rows_to_update(table, table, ["pk"]) # nothing has changed
print(time.monotonic() - start)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

pyiceberg.table.upsert_util.get_rows_to_updateから始め、20,000行、200列で提供されたPyArrowの再現コードを実行します。変更されていないテーブルでの現在の動作を比較し、一致した行がどこで比較されるかを追跡します。変更のないupsertの比較で、報告された列数依存の性能低下を回避しながら、更新対象として想定される行を維持できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
databases, performance
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。