apache / apache/iceberg-python
Upsert gets slow on tables with many columns
- Lingua principale
- Python
- Stelle
- 1.1k
- Fork
- 581
- Merge medio
- 1g 17h
- PR unite (30g)
- 78
Descrizione
### 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)
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia da pyiceberg.table.upsert_util.get_rows_to_update ed esegui la riproduzione PyArrow fornita con 20,000 righe e 200 colonne. Confronta il comportamento attuale su tabelle non modificate e traccia dove vengono confrontate le righe corrispondenti; il lavoro è completato quando il confronto di un upsert senza modifiche evita il rallentamento dipendente dal numero di colonne segnalato, preservando al contempo le righe previste da aggiornare.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- databases, performance
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100