I have to partition a few tables by date range. Do I have to drop the primary or reload the complete data to be able to partition these tables?
Some of the tables do contain a lot more than 50 million rows.
alter table temp_table_test1
partition by range (unix_timestamp(created_at))
(
partition p01 values less than (unix_timestamp('2015-02-01')),
partition p02 values less than (unix_timestamp('2015-02-01')),
partition p03 values less than (unix_timestamp('2015-02-01')),
partition p04 values less than (unix_timestamp('2015-02-01')),
partition p02 values less than (maxvalue)
);
This is the script I am using.
You don't need to do anything if you have no partitioning yet. According to this thread this will be done automatically: