摘要:
测试mysql列存储引擎的列压缩后的数据
DDL:
表结构:
CREATE TABLE t1 (c1 varchar(20))engine=TIANMU COMPRESSION="lz4";
mysql> show create table t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`c1` varchar(20) DEFAULT NULL
) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COMPRESSION='lz4'
1 row in set (0.00 sec)
数据插入脚本:
#!/bin/bash
index=0
while [[ true ]]; do
value="VALUE FOR $index"
#/stonedb57/install/bin/mysql -pstonedb123 -D tpch -e "INSERT into t1 value($value);"
echo /stonedb57/install/bin/mysql -uroot -pstonedb123 -S /stonedb57/install/tmp/mysql.sock -D tpch -e "INSERT into t1 value($value);"
/stonedb57/install/bin/mysql -uroot -pstonedb123 -S /stonedb57/install/tmp/mysql.sock -D tpch -e "INSERT into t1 value('$value');"
let index++
if [[ 100000 == $index ]]; then
break
fi
done
列数据:
插入数据时候列目录内的文件:
[root@zsl 0]# pwd
/stonedb57/install/data/tpch/t1.tianmu/columns/0
[root@zsl 0]#
[root@zsl 0]# tree
.
├── DATA
├── DN
├── filters
│ ├── bloom
│ ├── cmap
│ └── hist
├── META
└── v
├── 631ab12200002c29
├── 631ab12200002c2a
├── 631ab12200002c2b
├── 631ab12200002c2c
├── 631ab12200002c2d
├── 631ab12200002c2e
├── 631ab12200002c2f
├── 631ab12200002c30
├── 631ab12200002c31
└── 631ab12200002c32
5 directories, 13 files
列数据文件内容:
查看70847行的数据
[root@zsl 0]# hexdump -C DATA | grep -b3 70847
1178070-000c2290 45 20 46 4f 52 20 37 30 38 34 34 56 41 4c 55 45 |E FOR 70844VALUE|
1178149-000c22a0 20 46 4f 52 20 37 30 38 34 35 56 41 4c 55 45 20 | FOR 70845VALUE |
1178228-000c22b0 46 4f 52 20 37 30 38 34 36 56 41 4c 55 45 20 46 |FOR 70846VALUE F|
1178307:000c22c0 4f 52 20 37 30 38 34 37 56 41 4c 55 45 20 46 4f |OR 70847VALUE FO|
1178386-000c22d0 52 20 37 30 38 34 38 55 45 20 46 4f 52 20 33 35 |R 70848UE FOR 35|
1178465-000c22e0 31 37 36 56 41 4c 55 45 20 46 4f 52 20 33 35 31 |176VALUE FOR 351|
1178544-000c22f0 37 37 56 41 4c 55 45 20 46 4f 52 20 33 35 31 37 |77VALUE FOR 3517|