MySQL Forums
Forum List  »  Chinese

About mysql partition
Posted by: rocy cao
Date: September 04, 2008 12:25AM

我的mysql 是支持分区的
mysql> show variables like '%partition%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| have_partitioning | YES |
+-------------------+-------+
1 row in set (0.02 sec)

我创建表的语句是这样的:
CREATE TABLE `jobstat` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`jobNo` varchar(45) DEFAULT NULL,
`clickSum` int(10) unsigned DEFAULT NULL,
`showSum` int(10) unsigned DEFAULT NULL,
`mailSum` int(10) unsigned DEFAULT NULL,
`locationid` varchar(10) DEFAULT NULL,
`logdate` char(8) DEFAULT NULL,
PRIMARY KEY (`id`)
)

partition by RANGE(id)(
partition p0 values less than (5000000),
partition p1 values less than (10000000),
partition p2 values less than (15000000),
partition p3 values less than maxvalue
);
我想每500万数据在一个分区内。先创建了4个分区。

第一个问题: 我显示表的时候,显示的信息如下:
mysql> show create table jobstat\G;
*************************** 1. row ***************************
Table: jobstat
Create Table: CREATE TABLE `jobstat` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`jobNo` varchar(45) DEFAULT NULL,
`clickSum` int(10) unsigned DEFAULT NULL,
`showSum` int(10) unsigned DEFAULT NULL,
`mailSum` int(10) unsigned DEFAULT NULL,
`locationid` varchar(10) DEFAULT NULL,
`logdate` char(8) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_jobstat_jobNo` (`jobNo`) USING BTREE,
KEY `idx_jobstat_logdate` (`logdate`),
KEY `idx_jobstat_locationid` (`locationid`),
KEY `idx_jobstat_jobNo_logdate` (`jobNo`,`logdate`) USING BTREE,
KEY `idx_jobstat_clickSum` (`clickSum`),
KEY `idx_jobstat_showSum` (`showSum`)
) ENGINE=MyISAM AUTO_INCREMENT=14581386 DEFAULT CHARSET=gbk /*!50100 PARTITION BY RANGE (id) (PARTITION p0 VALUES LESS THAN (5000000) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (10000000) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (15000000) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
1 row in set (0.00 sec)

ERROR:
No query specified

这说明我创建分区成功了么,因为显示的语句把我创建分区的语句给 /* */起来了,所以感觉好像不大对似的。


第二个问题:
我往这个表中导入了数据,大约1500万条。
我可以知道具体的有哪些数据分别在那个分区么?
也就是我想检验我分区创建的效果实现没,我该怎么操作呢

第一次弄这个东西,很多不明白的地方,非常感谢。

Options: ReplyQuote


Subject
Views
Written By
Posted
About mysql partition
10985
September 04, 2008 12:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.