• Anurag Shekhar's avatar
    Bug #45840 read_buffer_size allocated for each partition when · 5999113f
    Anurag Shekhar authored
     "insert into.. select * from"
    
    When inserting into a partitioned table using 'insert into
    <target> select * from <src>', read_buffer_size bytes of memory
    are allocated for each partition in the target table.
    
    This resulted in large memory consumption when the number of
    partitions are high.
    
    This patch introduces a new method which tries to estimate the
    buffer size required for each partition and limits the maximum
    buffer size used to maximum of 10 * read_buffer_size, 
    11 * read_buffer_size in case of monotonic partition functions.
    
    sql/ha_partition.cc:
      Introduced a method ha_partition::estimate_read_buffer_size
      to estimate buffer size required for each partition. 
      Method ha_partition::start_part_bulk_insert updated
      to update the read_buffer_size before calling bulk upload
      in storage engines.
      Added thd in ha_partition::start_part_bulk_insert method signature.
    sql/ha_partition.h:
      Introduced a method ha_partition::estimate_read_buffer_size.
      Added thd in ha_partition::start_part_bulk_insert method signature.
    5999113f
ha_partition.h 44.7 KB