软件测试

收藏 / 订阅

MYSQL分区表功能测试简析

  1.查看Mysql版本是否支持分区

  SHOW VARIABLES LIKE '%partition%';

  +-------------------+-------+

  | Variable_name | Value |

  +-------------------+-------+

  | have_partitioning | YES |

  +-------------------+-------+

  如果VALUE 为YES 则支持分区,

  2.测试那种存储引擎支持分区

INOODB引擎

mysql> Create table engine1(id int) engine=innodb partition by range(id)(partition po values less than(10));

Query OK, 0 rows affected (0.01 sec)

MRG_MYISAM引擎

mysql> Create table engine2(id int) engine=MRG_MYISAM partition by range(id)(partition po values less than(10));

ERROR 1572 (HY000): Engine cannot be used in partitioned tables

blackhole引擎

mysql> Create table engine3(id int) engine=blackhole partition by range(id)(partition po values less than(10));

Query OK, 0 rows affected (0.01 sec)

CSV引擎

mysql> Create table engine4(id int) engine=csv partition by range(id)(partition po values less than(10));

ERROR 1572 (HY000): Engine cannot be used in partitioned tables

Memory引擎

mysql> Create table engine5(id int) engine=memory partition by range(id)(partition po values less than(10));

Query OK, 0 rows affected (0.01 sec)

federated引擎

mysql> Create table engine6(id int) engine=federated partition by range(id)(partition po values less than(10));

Query OK, 0 rows affected (0.01 sec)

archive引擎

mysql> Create table engine7(id int) engine=archive partition by range(id)(partition po values less than(10));

Query OK, 0 rows affected (0.01 sec)

myisam 引擎

mysql> Create table engine8(id int) engine=myisam partition by range(id)(partition po values less than(10));

Query OK, 0 rows affected (0.01 sec)

  3.Mysql分区表,分区引擎测试

  表分区的存储引擎相同

  mysql> Create table pengine1(id int) engine=myisam partition by range(id)(partition po values less than(10) engine=myisam, partition p1 values less than(20) engine=myisam);

  Query OK, 0 rows affected (0.05 sec)

  表分区的存储引擎不同

  mysql> Create table pengine2(id int) engine=myisam partition by range(id)(partition po values less than(10) engine=myisam, partition p1 values less than(20) engine=innodb);

  ERROR 1497 (HY000): The mix of handlers in the partitions is not allowed in this version of MySQL

  同一个分区表中的所有分区必须使用同一个存储引擎,并且存储引擎要和主表的保持一致。


关注微信公众号:了解更多技术文章  北京尚脑软件测试

喜欢 (88) or分享 (0)
首页  上一页  12345678910  下一页 尾页 共73条记录 1/10

网友评论:7

  1. 小编 1年前 (2015-03-22) #5

    软件测试入门 :mrgreen:

留言主题 *

您的姓名 *

电子信箱:

电话号码:

请你留言: