云数据库 RDS-测试方法:测试模型

时间:2024-11-20 10:24:57

测试模型

  1. 表结构

    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

  2. 读写比

    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})

support.huaweicloud.com/pwp-rds/rds_swp_mysql_01.html