How to alter order for subpartition in MySQL?

时间:2016-08-31 17:30:45

标签: mysql

I have created a table with subpartitions based on month and I accidentally make the December become the first month. So now it looks like this in information_schema.partitions:

enter image description here

Here is the code that I created the partition:

ALTER TABLE table123
 PARTITION BY RANGE( YEAR(CreatedDate) )
    SUBPARTITION BY HASH(MONTH(CreatedDate) ) (


        PARTITION p2016 VALUES LESS THAN (2017) (
            SUBPARTITION dec_2016,
            SUBPARTITION jan_2016,
            SUBPARTITION feb_2016,
            SUBPARTITION mar_2016,
            SUBPARTITION apr_2016,
            SUBPARTITION may_2016,
            SUBPARTITION jun_2016,
            SUBPARTITION jul_2016,
            SUBPARTITION aug_2016,
            SUBPARTITION sep_2016,
            SUBPARTITION oct_2016,
            SUBPARTITION nov_2016
        ),

        PARTITION p2017 VALUES LESS THAN (2018) (
            SUBPARTITION dec_2017,
            SUBPARTITION jan_2017,
            SUBPARTITION feb_2017,
            SUBPARTITION mar_2017,
            SUBPARTITION apr_2017,
            SUBPARTITION may_2017,
            SUBPARTITION jun_2017,
            SUBPARTITION jul_2017,
            SUBPARTITION aug_2017,
            SUBPARTITION sep_2017,
            SUBPARTITION oct_2017,
            SUBPARTITION nov_2017
        )

        PARTITION p2018 VALUES LESS THAN (2019) (
            SUBPARTITION dec_2018,
            SUBPARTITION jan_2018,
            SUBPARTITION feb_2018,
            SUBPARTITION mar_2018,
            SUBPARTITION apr_2018,
            SUBPARTITION may_2018,
            SUBPARTITION jun_2018,
            SUBPARTITION jul_2018,
            SUBPARTITION aug_2018,
            SUBPARTITION sep_2018,
            SUBPARTITION oct_2018,
            SUBPARTITION nov_2018
        )

I wonder if there is any way to modify the order of the subpartitions without recreating or dropping the subpartitions and not effecting the data sitting in the table?

0 个答案:

没有答案