建表语句如下:
create table comment_partition(
id int not null auto_increment,
commenterIpv4 char(30),...commentDate varchar(255),
primary key(id,blog))
partition by linear hash(blog)
partitions 10;
注意:用blog字段来分区...我也写了份c3p0的使用实例,在我的OSChina上,欢迎大家阅读并提出建议。。。。','2016-06-07 11-56'),(3,'127.0.0.1',2,'谢博主分享。。。'...'),(13,'127.0.0.1',4,'看了看了','2016-06-08 19-38');
插入数据后mysql会根据不同的blog的值将记录放到不同的区中,如下为查看我们查询时mysql从哪个分区查询我们的数据...mysql的命令窗口中输入如下命令):
explain partitions select id,blog from comment_partition where blog=6;
结果如下图(从p6分区中查询到