diff options
author | Anurag Shekhar <anurag.shekhar@sun.com> | 2009-09-17 17:35:43 +0530 |
---|---|---|
committer | Anurag Shekhar <anurag.shekhar@sun.com> | 2009-09-17 17:35:43 +0530 |
commit | 5999113f3323f520213b809e11fb439805bc514f (patch) | |
tree | e30d75367c98091cc97a9a5c6da7a40e0ea17794 /sql/ha_partition.h | |
parent | 7cf8f7a4bb465eca331fb08568127eadb709a4a2 (diff) | |
download | mariadb-git-5999113f3323f520213b809e11fb439805bc514f.tar.gz |
Bug #45840 read_buffer_size allocated for each partition when
"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.
Diffstat (limited to 'sql/ha_partition.h')
-rw-r--r-- | sql/ha_partition.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/ha_partition.h b/sql/ha_partition.h index f47dfe8f621..1c863d6c294 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -367,7 +367,8 @@ public: virtual int end_bulk_insert(); private: ha_rows guess_bulk_insert_rows(); - void start_part_bulk_insert(uint part_id); + void start_part_bulk_insert(THD *thd, uint part_id); + long estimate_read_buffer_size(long original_size); public: virtual bool is_fatal_error(int error, uint flags) |