我有以下当前已分区的 MySQL 表。
我想在“message_read”键上添加子分区 - 这是为了优化通过分区搜索未读消息。
CREATE TABLE `messages` (
`pid` int(50) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary Key',
`userid1` int(10) unsigned NOT NULL COMMENT 'Message Sender',
`userid2` int(10) unsigned NOT NULL COMMENT 'Message Receiver',
`message` text NOT NULL COMMENT 'Actual Message',
`message_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0=Not Read & 1=Read',
`datetime` datetime NOT NULL COMMENT 'Date Time',
PRIMARY KEY (`pid`,`datetime`),
KEY `userid1` (`userid1`),
KEY `userid2` (`userid2`),
KEY `message_read` (`message_read`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
/*!50100 PARTITION BY RANGE (TO_DAYS(`datetime`))
(PARTITION p0 VALUES LESS THAN (735234) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN (735265) ENGINE = InnoDB,
PARTITION p2 VALUES LESS THAN (735293) ENGINE = InnoDB,
PARTITION p3 VALUES LESS THAN (735324) ENGINE = InnoDB,
PARTITION p4 VALUES LESS THAN (735354) ENGINE = InnoDB,
PARTITION p5 VALUES LESS THAN (735385) ENGINE = InnoDB,
PARTITION p6 VALUES LESS THAN (735415) ENGINE = InnoDB) */
当前分区在日期时间戳上。我如何添加到“message_read”的子分区中?
谢谢你