distsqlrun: top k disk sorter never discards rows #31901
Labels
A-sql-execution
Relating to SQL execution.
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
Milestone
The disk implementation of the top k sorter's
MaybeReplaceMax
method, which is supposed to sort the row into the top k rows and keep the number of saved rows at k, is currently implemented as just adding the row to the sorted disk map of rows.This is quite inefficient - I think in this case it's just falling back to global sort.
I don't think it's a huge deal - how often do we really spill top-k sorts to disk? - but this is probably something that should be fixed to prevent really bad edge case performance.
The text was updated successfully, but these errors were encountered: