I'm trying to benchmark Read/Write speed in MySQL 5.5. Currently I have a stored procedure that insert rows with random numbers to a table and I'm measuring time of execution before and after configuration changes.

Here's my procedure:

CREATE DEFINER=`root`@`localhost` PROCEDURE `InsertRand`(IN nor INT, in minr int, in maxr int)
        declare i int;
        declare lastid int;
        set i =1;
        start transaction;
        while i <= nor do
        insert into tbltest(Value) values (minr + CEIL(rand() * (maxr-minr)));
        set lastid = (select MAX(id) from tbltest);
        set i = i +1;
        end while;

Do you know any good way to benchmark this ? Maybe my procedure needs some improvement?

1 Answer 1


You should use MySQL's BENCHMARK() function

Here are my posts on how to use it

BTW if you do configuartion changes, you should restart mysqld immediately after the configuration changes are in place. Then, run your I/O tests.

  • Very precise and useful answer :) exactly what i needed :) thanks a lot! Jun 23, 2015 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.