MYSQL壓縮表測試
1. 建立表
-- 壓縮表
SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_file_format=Barracuda;
CREATE TABLE compress_01 (
id varchar(36) PRIMARY KEY
,name varchar(255)
)
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8
;
CREATE TABLE compress_02 (
id varchar(36) PRIMARY KEY
,name varchar(255)
)
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8
;
CREATE TABLE compress_03 (
id varchar(36) PRIMARY KEY
,name varchar(255)
)
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8
;
-- 普通表
CREATE TABLE normal_01 (
id varchar(36) PRIMARY KEY
,name varchar(255)
)
;
CREATE TABLE normal_02 (
id varchar(36) PRIMARY KEY
,name varchar(255)
)
;
2. 造測試資料
insert into compress_01
select uuid() as id, 'name_1' as name
;
insert into compress_01
select uuid() as id, 'name_2' as name
from compress_01
;
insert into compress_01
select uuid() as id, 'name_3' as name
from compress_01
;
insert into compress_01
select uuid() as id, 'name_24' as name
from compress_01
;
3. 插入效能測試
-- 3.1 壓縮表 to 普通表
insert into normal_01
select * from compress_01
;
> Affected rows: 8388608
> 時間: 244.767s
-- 3.2 普通表 to 普通表
insert into normal_02
select * from normal_01
;
> Affected rows: 8388608
> 時間: 242.232s
-- 3.3 壓縮表 to 壓縮表
insert into compress_02
select * from compress_01
;
> Affected rows: 8388608
> 時間: 250.885s
-- 3.4 普通表 to 壓縮表
insert into compress_03
select * from normal_02
;
> Affected rows: 8388608
> 時間: 253.055s
4. 單表查詢效能測試
-- 4.1 select查詢 主鍵
select * from normal_01 where id = '408f0dd5-3abb-11eb-b5bb-0242ac110002' limit 10; -- 0.037
select * from compress_02 where id = '408f0dd5-3abb-11eb-b5bb-0242ac110002' limit 10; -- 0.039
-- 4.2 select查詢 索引
-- 4.3 select查詢 非主鍵
select * from normal_01 where name = 'name_23' limit 10; -- 0.616
select * from compress_02 where name = 'name_23' limit 10; -- 1.087
-- 4.4 count查詢
select count(1) as cnt from normal_01; -- 1.018
select count(1) as cnt from compress_02; -- 2.269
-- 4.5 count distinct 查詢
select count(distinct name) as cnt from normal_01; -- 5.044
select count(distinct name) as cnt from compress_02; -- 7.131
-- 4.6 分頁查詢
select * from normal_01 limit 50000,10; -- 0.043
select * from compress_02 limit 50000,10; -- 0.043
-- 4.6 in查詢
5. 多表關聯查詢效能測試(雪花模型)
6. 多表關聯查詢效能測試(大表關聯大表)
7. 刪除資料效能
-- 7.1 刪除記錄
-- 7.2 truncate table
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69989885/viewspace-2741271/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 5.6的表壓縮2020-01-10MySql
- Linux下各壓縮方式測試(壓縮率和使用時間)2018-11-16Linux
- MySQL實現MYISAM表批次壓縮的方法2021-09-09MySql
- oracle壓縮表(二)2019-07-19Oracle
- oracle壓縮表(一)2019-05-21Oracle
- oracle 的表壓縮2021-05-12Oracle
- 當mysql表從壓縮表變成普通表會發生什麼2022-07-12MySql
- mysql壓縮解決方案2021-12-21MySql
- Sqlserver表和索引壓縮2022-10-24SQLServer索引
- 壓縮錶轉非壓縮表(線上重定義)2023-12-25
- Nginx網路壓縮 CSS壓縮 圖片壓縮 JSON壓縮2022-02-08NginxCSSJSON
- MySQL的壓測2021-12-13MySql
- mysql benchmarksql 壓測2022-11-15MySql
- Mac安裝壓縮版MySQL Server2024-04-07MacMySqlServer
- mysql~關於mysql分割槽表的測試2024-03-13MySql
- 檔案壓縮和解壓縮2024-06-30
- MySQL 壓縮二進位制日誌2020-11-05MySql
- MySQL 效能壓測工具,從入門到自定義測試項2022-12-21MySql
- benchmarksql 5.0壓測MySQL2022-12-09MySql
- 壓力測試2018-11-16
- Python實現壓縮和解壓縮2024-04-09Python
- linux下壓縮解壓縮命令2020-07-17Linux
- linux壓縮和解壓縮命令整理2020-10-10Linux
- JS壓縮方法及批量壓縮2022-07-15JS
- 混合列壓縮(HCC)在OLAP及OLTP場景中的測試2019-04-04
- MySQL 效能壓測工具-sysbench,從入門到自定義測試項2022-12-06MySql
- mysql5.7.x用壓縮包安裝2024-11-08MySql
- MySQL 可以壓縮或回收磁碟空間嗎2023-01-11MySql
- Linux tar分卷壓縮與解壓縮2020-05-06Linux
- (一)效能測試(壓力測試、負載測試)2020-12-15負載
- mysql收縮共享表空間2018-04-20MySql
- 簡單瞭解一下壓縮表2019-03-31
- Linux壓縮解壓2018-05-18Linux
- CentOS 壓縮解壓2021-10-23CentOS
- sysbench 壓力測試2020-01-06
- MACOSXApacheab壓力測試2018-12-26MacApache
- ORACLE壓力測試2022-01-06Oracle
- laravel壓力測試2021-05-22Laravel