how to drop partition without dropping data in MySQL?

vidyadhar picture vidyadhar · Jan 7, 2013 · Viewed 28.9k times · Source

I have a table like:

create table registrations( 
id int not null auto_increment primary key,
name varchar(50),
mobile_number varchar(13)) 
engine=innodb 
partition by range(id) (
partition p0 values less than (10000),
partition p0 values less than (20000),
partition p0 values less than max value);

Not exactly like above but similar to that....

Now assume that my table has 200000 rows and now I want to remove partitions on the table and reorganize them in accordance to requirement without MAX VALUE in it.

Can any one help me to rearrange partition without dropping data or dropping table and recreating it ?

Answer

user2643317 picture user2643317 · Aug 1, 2013
ALTER TABLE tbl REMOVE PARTITIONING;