首页 > Linux操作系统 > Linux操作系统 > Partitions
1.Create TABLE With Partition
CREATE TABLE userData(
`name` varchar(32) DEFAULT NULL,
`OperTime` datetime DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
/*!50100 PARTITION BY RANGE (EXTRACT(YEAR_MONTH FROM OperTime))
(PARTITION p1104 VALUES LESS THAN (201105),
PARTITION p1105 VALUES LESS THAN (201106),
PARTITION p1106 VALUES LESS THAN MAXVALUE) */;
2.Alter Table Partition
ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN (2002));
This section discusses obtaining information about existing partitions, which can be done in a number of ways. Methods of obtaining such information include the following:
Using the SHOW CREATE TABLE statement to view the partitioning clauses used in creating a partitioned table.
Using the SHOW TABLE STATUS statement to determine whether a table is partitioned.
Querying the INFORMATION_SCHEMA.PARTITIONS table.
Using the statement EXPLAIN PARTITIONS SELECT to see which partitions are used by a given SELECT.
SHOW VARIABLES LIKE '%partition%';
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11075/viewspace-714460/ ,如需转载,请注明出处,否则将追究法律责任。