1. drop table if exists foo;
    2. create table foo
    3. (
    4. id int unsigned not null auto_increment primary key,
    5. val smallint unsigned not null default 0
    6. )
    7. engine=innodb;
    8. drop procedure if exists load_foo_test_data;
    9. delimiter #
    10. create procedure load_foo_test_data()
    11. begin
    12. declare v_max int unsigned default 1000;
    13. declare v_counter int unsigned default 0;
    14. truncate table foo;
    15. start transaction;
    16. while v_counter < v_max do
    17. insert into foo (val) values ( floor(0 + (rand() * 65535)) );
    18. set v_counter=v_counter+1;
    19. end while;
    20. commit;
    21. end #
    22. delimiter ;
    23. call load_foo_test_data();
    24. select * from foo order by id;