跳转至

性能测试

插入300w条数据

用时 4小时

test> CREATE PROCEDURE test()
      BEGIN
          DECLARE i INT;
          SET i = 0;
          lp :
          LOOP
              INSERT INTO test.big_data (indexs, content, other)
              VALUES (uuid(), '中文维基百科... 此处省略 2000字
      ', uuid());
              SET i = i + 1;
              IF i > 3000000 THEN
                  LEAVE lp;
              END IF;
          END LOOP;
          SELECT * FROM test.big_data;
      END
[2022-03-06 11:58:50] completed in 23 ms
test> CALL test()
[2022-03-06 18:52:23] 500 rows retrieved starting from 1 in 6 h 53 m 32 s 690 ms (execution: 6 h 53 m 32 s 246 ms, fetching: 444 ms)

性能测试

select *
from big_data where content like '中文维%'limit 500;

用时 695ms

select *
from big_data where content like '中文维%';

好久 没耐心等了

select *
from big_data where other like limit 500;;

用时 2s294

select *
from big_data where other like '%11ec-b741%';

机子卡了 , 结果太多了

select *
from big_data where other = 'bb44d05f-9d01-11ec-b741-0242ac110002';

无索引精确查询

9m24时447ms

create index big_data_other_index
    on big_data (other);

添加索引

select *
from big_data where other = 'bb44d05f-9d01-11ec-b741-0242ac110002';

用时 83ms