本文介绍云数据库 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 c FROM ${rand_table_name} where id=${rand_id};
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 ${rand_table_name} SET k=k+1 WHERE id=${rand_id} UPDATE ${rand_table_name} SET c=${rand_str} WHERE id=${rand_id}
DELETE FROM ${rand_table_name} WHERE id=${rand_id}
INSERT INTO ${rand_table_name} (id, k, c, pad) VALUES (${rand_id},${rand_k},${rand_str_c},${rand_str_pad})