I'm trying create a partition in mysql on a date column MV_DATE
is of type DATE
Here's the query -
ALTER TABLE table_name PARTITION BY RANGE (TO_DAYS(MV_DATE))(PARTITION p0 VALUES LESS THAN (TO_DAYS('2015-08-31')));
I get the error A PRIMARY KEY must include all columns in the table's partitioning function
MV_DATE
isn't the primary key of my table.
I also tried ALTER TABLE JOB_VOL_SWH PARTITION BY RANGE ((MV_DATE))(PARTITION p0 VALUES LESS THAN (TO_DAYS('2015-08-31')));
which throws the error ERROR 1659 (HY000): Field 'JB_DATE' is of a not allowed type for this type of partitioning
I've a tried a few options now but none seem to work.
Is there a special way to create partitioning by date ranges? The MYSQL table has close to a billion rows of data which pretty much means my queries don't return at all (virtually). Hence, looking to partition the tables.