• Varun Gupta's avatar
    MDEV-24015: SQL Error (1038): Out of sort memory when enough memory for the sort buffer is provided · db56f9b8
    Varun Gupta authored
    For a correlated subquery filesort is executed multiple times.
    During each execution, sortlength() computed total sort key length in
    Sort_keys::sort_length, without resetting it first.
    
    Eventually Sort_keys::sort_length got larger than @@sort_buffer_size, which
    caused filesort() to be aborted with error.
    
    Fixed by making sortlength() to compute lengths only during the first
    invocation. Subsequent invocations return pre-computed values.
    db56f9b8
order_by.result 102 KB