apache / apache/datafusion

Avoiding spilling in TopK queries by reinserting the to-spill data to memory buffer

Offen
#3,579 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Rust
Sterne
9.3k
Forks
2.4k
Ø Merge
3 T. 11 Std.
Gemergte PRs (30 T.)
360

Beschreibung

**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
We recently added optimizations for `ORDER BY expr LIMIT` by pushing limits to individual operations (saving memory, CPU time + limiting output rows) and executing sorts in parallel.

The disk spill operation in `SortExec` currently still assumes the to-spill disk doesn't fit in memory.
However after sorting we only have to keep the batch(es) with top `fetch` rows and store those, which probably avoids spilling to disk.

**Describe the solution you'd like**
We can identify that the to-spill data fits in memory after being merged / sorted and avoid spilling to disk.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie damit, den SortExec-Disk-Spill-Pfad sowie die im Issue beschriebenen Arbeiten zu ORDER BY expr LIMIT limit-pushdown und parallel-sort zu lesen. Bestimmen Sie, wie zusammengeführte Top-Fetch-Batches am Speicherpuffer gemessen werden können; erledigt ist die Arbeit, wenn passende Batches im Speicher gehalten werden, ohne auf die Festplatte ausgelagert zu werden, und das relevante Sortier- und Spill-Verhalten durch Tests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.