mysql增加分区
mysql增加分区
增加分区,是修改原有分区,从而替换现有分区
ALTERTABLE xxx表 PARTITION BY RANGE COLUMNS(CREATE_TIME)
(
PARTITION p20210901 VALUES LESS THAN ('2021-10-01 00:00:00') ENGINE = InnoDB,
PARTITION p20211001 VALUES LESS THAN ('2021-11-01 00:00:00') ENGINE = InnoDB,
PARTITION p20211101 VALUES LESS THAN ('2021-12-01 00:00:00') ENGINE = InnoDB,
PARTITION p20211201 VALUES LESS THAN ('2022-01-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220101 VALUES LESS THAN ('2022-02-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220201 VALUES LESS THAN ('2022-03-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220301 VALUES LESS THAN ('2022-04-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220401 VALUES LESS THAN ('2022-05-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220501 VALUES LESS THAN ('2022-06-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220601 VALUES LESS THAN ('2022-07-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220701 VALUES LESS THAN ('2022-08-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220801 VALUES LESS THAN ('2022-09-01 00:00:00') ENGINE = InnoDB,
PARTITION p20220901 VALUES LESS THAN ('2022-10-01 00:00:00') ENGINE = InnoDB,
PARTITION p20221001 VALUES LESS THAN ('2022-11-01 00:00:00') ENGINE = InnoDB,
PARTITION p20221101 VALUES LESS THAN ('2022-12-01 00:00:00') ENGINE = InnoDB,
PARTITION p20221201 VALUES LESS THAN ('2023-01-01 00:00:00') ENGINE = InnoDB,
PARTITION pmax VALUES LESS THAN ('2223-01-01 00:00:00') ENGINE = InnoDB
)
执行以下语句:
EXPLAIN SELECT * FROM sf表 s where s.CREATE_TIME>='2022-09-19 00:00:00' and s.CREATE_TIME<'2022-09-20 00:00:00'
更多推荐
所有评论(0)