如果已经存在数据,操作前记得备份数据
将现有表转换为范围分区表
1 | ALTER TABLE table_name PARTITION BY RANGE COLUMNS(date) ( |
将现有表转换为HASH分区表
1 | ALTER TABLE table_name PARTITION BY HASH(column_name) PARTITIONS 10; |
查看分区表状态:
1 | SELECT partition_name, partition_ordinal_position, partition_method, partition_expression, partition_description, table_rows FROM information_schema.partitions WHERE table_schema = 'mirage' AND table_name = 'table_name'; |