You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Performance]: Value window functions (lag/lead/first_value/last_value/nth_value) have O(n²) memory hotspot #23962
The current value window function execution model materializes the entire frame into heap for each output row under the default UNBOUNDED PRECEDING ... UNBOUNDED FOLLOWING scenario, causing time and space complexity to approach O(n²).
Core issues:
valueWindowExec stores the complete frame for each output row in frameValues [][]*valueEntry
Varlen types (varchar/text/blob/json) produce massive make+copy allocations
Fill call count approaches n*n (n = partition row count)
Free() does not clean up frameValues, relying mainly on GC
Size() severely underestimates actual memory usage
nth_value semantics not fully implemented (degrades to first_value)
Affected functions: lag, lead, first_value, last_value, nth_value
Especially significant with large partitions, varlen types, and high concurrency.
Activity