apache / apache/iceberg-python
Upsert gets slow on tables with many columns
- Langage dominant
- Python
- Étoiles
- 1.1k
- Forks
- 581
- Merge moyen
- 1 j 17 h
- PR mergées (30 j)
- 78
Description
### 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)
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par pyiceberg.table.upsert_util.get_rows_to_update et exécutez la reproduction PyArrow fournie avec 20,000 lignes et 200 colonnes. Comparez le comportement actuel sur des tables inchangées et suivez l’endroit où les lignes correspondantes sont comparées ; le travail est terminé lorsque la comparaison d’un upsert sans changement évite le ralentissement lié au nombre de colonnes signalé tout en préservant les lignes attendues à mettre à jour.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- databases, performance
- Type d'issue
- Fonctionnalité
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 68/100