视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
MySQL5.6新特性测试
2020-11-09 13:10:10 责编:小采
文档


在微博上看到隔壁部门的同事发布了一个介绍MySQL 5.6新特性的slide。遂对其中几个对我们业务有用的特性做了测试。 Found a slide which introducing new features in MySQL 5.6, which is made by a colleague in other department. For our business, I ran

在微博上看到隔壁部门的同事发布了一个介绍MySQL 5.6新特性的slide。遂对其中几个对我们业务有用的特性做了测试。

Found a slide which introducing new features in MySQL 5.6, which is made by a colleague in other department. For our business, I ran some tests on some features.

  • InnoDB Compression
  • //压缩前(before compress)
    Name: workticket
    Engine: InnoDB
    Version: 10
    Row_format: Compact
    Rows: 1471830
    Avg_row_length: 328
    Data_length: 483295232
    Max_data_length: 0
    Index_length: 260276224
    Data_free: 5242880
    Auto_increment: 3473533
    Create_time: 2013-04-15 16:01:01
    Update_time: NULL
    Check_time: NULL
    Collation: utf8_general_ci
    Checksum: NULL
    Create_options: 
    Comment: 工单表
    //压缩后(after compress)
    Name: workticket
    Engine: InnoDB
    Version: 10
    Row_format: Compressed
    Rows: 1553544
    Avg_row_length: 143
    Data_length: 222281728
    Max_data_length: 0
    Index_length: 121192448
    Data_free: 2621440
    Auto_increment: 3473533
    Create_time: 2013-04-15 16:06:33
    Update_time: NULL
    Check_time: NULL
    Collation: utf8_general_ci
    Checksum: NULL
    Create_options: row_format=COMPRESSED
    Comment: 工单表

    但还是不够myisampack后的myisam省空间

    But InnoDB Compression is less storage efficient than MyISAM after myisampack.

    -rw-rw---- 1 mysql mysql 9.5K Apr 16 09:35 workticket.frm
    -rw-rw---- 1 mysql mysql 9.5K Apr 16 09:45 workticket_innodb.frm
    -rw-rw---- 1 mysql mysql 336M Apr 16 09:58 workticket_innodb.ibd
    -rw-rw---- 1 mysql mysql 199M Apr 16 09:41 workticket.MYD
    -rw-rw---- 1 mysql mysql 86M Apr 16 09:44 workticket.MYI
     Name: workticket
     Engine: MyISAM
     Version: 10
     Row_format: Dynamic
     Rows: 1593851
     Avg_row_length: 201
     Data_length: 321325744
    Max_data_length: 281474976710655
     Index_length: 130242560
     Data_free: 0
     Auto_increment: 3473533
     Create_time: 2013-04-16 09:35:53
     Update_time: 2013-04-16 09:41:09
     Check_time: 2013-04-16 09:37:03
     Collation: utf8_general_ci
     Checksum: NULL
     Create_options: 
     Comment: 工单表
  • InnoDB Online DDL
  • mysql> ALTER TABLE `workticket` ADD COLUMN `test_col` INT NOT NULL AFTER sid, LOCK=NONE;
    Query OK, 0 rows affected (5 min 25.17 sec)
    Records: 0 Duplicates: 0 Warnings: 0
    mysql> set old_alter_table=1;
    Query OK, 0 rows affected (0.00 sec)
    mysql> ALTER TABLE `workticket` ADD COLUMN `test_col` INT NOT NULL AFTER sid, LOCK=NONE; 
    ERROR 1846 (0A000): LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
    mysql> ALTER TABLE `workticket` ADD COLUMN `test_col` INT NOT NULL AFTER sid, LOCK=SHARED;
    Query OK, 1593851 rows affected (4 min 11. sec)
    Records: 1593851 Duplicates: 0 Warnings: 0

    虽然总体耗时更长,但DDL过程中不锁表(可query and/or 可DML)还是很吸引的(详细的DDL操作是否可query and/or 可DML可参见文档)。

    Although costing more time, that the table can be query and/or execute DML query is very amazing. (Detail can be seen in documentation)

  • InnoDB-Transportable Tablespaces
    没什么可测试的,就是操作成功。用途?建slave?备份?
    Nothing interesting to test. It just works. What can I do with this feature? Maybe building up a slave server? Or backup up the database?
  • 下载本文
    显示全文
    专题