[MDEV-791] LP:998130 - Avoid copying on REORGANIZE PARTITION where possible Created: 2012-05-11  Updated: 2015-11-17

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Hartmut Holzgraefe Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug998130.xml    

 Description   

When modifying a range partition using ALTER TABLE...REORGANIZE PARTITION it may happen that all rows from the original partition end up in the same new partition. In this case the underlying table could simply be reused intead of being copied over as it happens now.

E.g.

CREATE TABLE `t1` (
`id` int auto_increment primary key,
) ENGINE=InnoDB
PARTITION BY RANGE (id)
(PARTITION p1 VALUES LESS THAN (1500000) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
;
 
INSERT INTO t1 SELECT NULL;
INSERT INTO t1 SELECT NULL FROM t1; -- repeat until > 1 million affected rows are reported 
 
SELECT max(id) FROM t1; -- verify that number of rows is somehere between 1.6 and 2.9 million
 
ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (
  PARTITION p2 VALUES LESS THAN (3000000),
  PARTITION p3 VALUES LESS THAN MAXVALUE
);

All rows from the original p2 will end up in the new p2 anyway, so the REORGANIZE could just create the new empty p3 partition and modify the top level partition meta information, but the operation is actually taking quite some time as it simply seems to copy over all data from the old p2 partition to the new one ...



 Comments   
Comment by Rasmus Johansson (Inactive) [ 2012-05-13 ]

Launchpad bug id: 998130

Generated at Thu Feb 08 06:31:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.