• Mattias Jonsson's avatar
    Bug#13025132 - PARTITIONS USE TOO MUCH MEMORY · 8c72fd8b
    Mattias Jonsson authored
    The buffer for the current read row from each partition
    (m_ordered_rec_buffer) used for sorted reads was
    allocated on open and freed when the ha_partition handler
    was closed or destroyed.
    
    For tables with many partitions and big records this could
    take up too much valuable memory.
    
    Solution is to only allocate the memory when it is needed
    and free it when nolonger needed. I.e. allocate it in
    index_init and free it in index_end (and to handle failures
    also free it on reset, close etc.)
    
    Also only allocating needed memory, according to
    partitioning pruning.
    
    Manually tested that it does not use as much memory and
    releases it after queries.
    8c72fd8b
ha_partition.h 47.3 KB