Upsert with 1M rows extremely slow due to `create_match_filter` and `txn.delete()` performance
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- Calme
- Stack technique
- python
- Domaine
- data-engineering, databases
Piste de recherche
Commencez par les points d’entrée create_match_filter et txn.delete() décrits dans le rapport, puis reproduisez le benchmark d’upsert de 1M lignes à partir des mesures fournies. Consultez les issues associées #2159, #2138 et #2943 pour prendre connaissance du contexte existant. Le travail est terminé lorsqu’une amélioration mesurée ou une méthode documentée et prise en charge pour éviter le coût signalé de la suppression de toute la table est disponible.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Apache Iceberg version
0.11.0
Please describe the bug 🐞
CC @goutamvenkat-anyscale @koenvo @Fokko
Hello! We are implementing distributed writes from Ray Data to Iceberg. As part of upserts, we:
- Write data files in parallel across Ray workers (each worker writes its share of Parquet files directly to storage and returns
DataFilemetadata + the upsert key columns back to the driver) - On the driver, concatenate all upsert keys collected from workers, call
create_match_filterto build a delete predicate, then calltxn.delete()followed by an append to commit
Upserting 1M rows (383 MiB) into an Iceberg table takes ~17.5 minutes, almost entirely in the delete step:
create_match_filter (1M keys → In filter): 10.26s
txn.delete(): 1054.35s
append + commit: 1.14s
─────────────────────────────────────────────────────
Total upsert commit: 1065.75s
PyIceberg version 0.11.0
This matches what's reported in #2159 and #2138.
The bottlenecks are:
create_match_filter— constructs a PythonBooleanExpressionnode per row, which is expensive at 1M+ keystxn.delete()— evaluates the resulting giantInexpression against the table's data files with no partition pruning, effectively doing a full table scan
We have a few questions:
- Merge-on-read upserts — is this on the roadmap, and if so, roughly when? MoR would let us avoid the expensive delete + rewrite cycle entirely for large upserts.
- Optimizing
create_match_filterortxn.delete()— is there a recommended way to speed these up today? For example, batching theInfilter, or passing a partition-level hint to constrain the file scan? - Partition-aware deletes — if the upsert key columns overlap with partition columns, is there a supported way to restrict
txn.delete()to only the relevant partitions, rather than scanning the full table?
Related
- #2159 — Upserting large table extremely slow
- #2138 — Upsertion memory usage grows exponentially as table size grows
- #2943 — Optimize upsert performance for large datasets
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- Langage dominant
- Python
- Étoiles
- 1.1k
- Forks
- 589
- Merge moyen
- 1 j 20 h
- PR mergées (30 j)
- 68
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/iceberg-python
-
kind:bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
apache/iceberg-python#4006 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/iceberg-python#3996 ·
-
Deletion vector bitmap count is read from the blob and used as a loop bound without validation Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/iceberg-python#3979 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/iceberg-python#3885 ·
-
[Bug] PyArrowFileIO fails to propagate s3.ssl.ca-cert to pyarrow.fs.S3FileSystem tls_ca_file_path Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
apache/iceberg-python#3866 · 1 commentaire ·
Toutes les issues de apache/iceberg-python
Issues similaires
-
bug confirmed issue
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
open-webui/open-webui#30750 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
good first issue
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100