You need to enable JavaScript to run this app.
导航
测试模型
最近更新时间:2022.11.25 21:46:18首次发布时间:2022.06.24 15:51:03

本文介绍云数据库 MySQL 版性能测试所使用的测试模型。

测试模型

表结构

CREATE TABLE `sbtest` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`k` INTEGER UNSIGNED DEFAULT '0' NOT NULL,
`c` CHAR(120) DEFAULT '' NOT NULL,
`pad` CHAR(60) DEFAULT '' NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB

读写比

Sysbench 默认提交的事务中包含 18 条 SQL 语句,具体执行语句和条数如下:

  • 主键 SELECT 语句, 10 条:
SELECT c FROM ${rand_table_name} where id=${rand_id};

  • 范围 SELECT 语句, 4 条:
SELECT c FROM ${rand_table_name} WHERE id BETWEEN ${rand_id_start} AND ${rand_id_end};
SELECT SUM(K) FROM ${rand_table_name} WHERE id BETWEEN ${rand_id_start} AND ${rand_id_end};
SELECT c FROM ${rand_table_name} WHERE id BETWEEN ${rand_id_start} AND ${rand_id_end} ORDER BY c;
SELECT DISTINCT c FROM ${rand_table_name} WHERE id BETWEEN ${rand_id_start} AND ${rand_id_end} ORDER BY c;
  • UPDATE 语句, 2 条:
UPDATE ${rand_table_name} SET k=k+1 WHERE id=${rand_id}
UPDATE ${rand_table_name} SET c=${rand_str} WHERE id=${rand_id}
  • DELETE 语句, 1 条:
DELETE FROM ${rand_table_name} WHERE id=${rand_id}
  • INSERT 语句, 1 条:
INSERT INTO ${rand_table_name} (id, k, c, pad) VALUES (${rand_id},${rand_k},${rand_str_c},${rand_str_pad})