zoukankan      html  css  js  c++  java
  • MySQL 表压缩

    MySQL 表压缩

    1 前提

    启用表压缩,有两个参数是开启数据压缩的关键: innodb_file_per_table=1和innodb_file_format='Barracuda'

    只有这两个参数在启动数据库的时候为如上配置时,才允许开启表压缩。

    在较新的版本的MySQL 及 分支版本中,这两个参数的默认如此,支持表压缩。比如Mariadb 10.2.25 。

    本实验环境为 Mariadb 10.2.25

    2 开启方法

     

    2.1 建表时开启

    建表时指定 row_format 和 key_block_size

    create table test_compress_table(id int)
    ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
    

    2.2 修改表属性

    alter table test_compress_table key_block_size=8;
    或者
    alter table test_compress_table row_format=COMPRESSED;
    

    在执行过程中,会有一顺间的锁表,但是时间很短。结束之前,对DML操作无堵塞。

    3 压缩效果

    • 压缩前

      -rw-rw---- 1 mysql mysql  3690987520 4月  21 17:24 ins_prod.ibd
      
    • 压缩后

      -rw-rw---- 1 mysql mysql  1648361472 4月  21 18:10 ins_prod.ibd
      

    压缩比大概在55%。

    Author: halberd.lee

    Created: 2020-04-21 Tue 18:15

    Validate

  • 相关阅读:
    2018ddctf wp
    装饰器
    python作用域
    闭包
    迭代器
    ord() expected string of length 1, but int found
    pygm2安装问题
    elf逆向入门
    【POJ
    【POJ
  • 原文地址:https://www.cnblogs.com/halberd-lee/p/12746512.html
Copyright © 2011-2022 走看看