简体   繁体   中英

How make month wise partitioning in existing mysql table?

I have a table with hundreds of thousands of records. How to partition the table, month-wise?

You can ALTER TABLE to create new PARITIONS on it.

ALTER TABLE table_name PARTITION BY RANGE (MONTH(date_column)
(
  PARTITION JAN VALUES LESS THAN (2),
  PARTITION FEB VALUES LESS THAN (3),
  ...
  PARTITION DEC VALUES LESS THAN MAXVALUE
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM