create.sql 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # create benchmark user
  2. GRANT ALL ON *.* TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
  3. # modified from SO answer http://stackoverflow.com/questions/5125096/for-loop-in-mysql
  4. DROP DATABASE IF EXISTS hello_world;
  5. CREATE DATABASE hello_world;
  6. USE hello_world;
  7. DROP TABLE IF EXISTS World;
  8. CREATE TABLE World (
  9. id int(10) unsigned NOT NULL auto_increment,
  10. randomNumber int NOT NULL default 0,
  11. PRIMARY KEY (id)
  12. )
  13. ENGINE=INNODB;
  14. DROP PROCEDURE IF EXISTS load_data;
  15. DELIMITER #
  16. CREATE PROCEDURE load_data()
  17. BEGIN
  18. declare v_max int unsigned default 10000;
  19. declare v_counter int unsigned default 0;
  20. TRUNCATE TABLE World;
  21. START TRANSACTION;
  22. while v_counter < v_max do
  23. INSERT INTO World (randomNumber) VALUES ( floor(0 + (rand() * 10000)) );
  24. SET v_counter=v_counter+1;
  25. end while;
  26. commit;
  27. END #
  28. DELIMITER ;
  29. CALL load_data();
  30. DROP TABLE IF EXISTS Fortune;
  31. CREATE TABLE Fortune (
  32. id int(10) unsigned NOT NULL auto_increment,
  33. message varchar(2048) CHARACTER SET 'utf8' NOT NULL,
  34. PRIMARY KEY (id)
  35. )
  36. ENGINE=INNODB;
  37. INSERT INTO Fortune (message) VALUES ('fortune: No such file or directory');
  38. INSERT INTO Fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.');
  39. INSERT INTO Fortune (message) VALUES ('After enough decimal places, nobody gives a damn.');
  40. INSERT INTO Fortune (message) VALUES ('A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1');
  41. INSERT INTO Fortune (message) VALUES ('A computer program does what you tell it to do, not what you want it to do.');
  42. INSERT INTO Fortune (message) VALUES ('Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen');
  43. INSERT INTO Fortune (message) VALUES ('Any program that runs right is obsolete.');
  44. INSERT INTO Fortune (message) VALUES ('A list is only as strong as its weakest link. — Donald Knuth');
  45. INSERT INTO Fortune (message) VALUES ('Feature: A bug with seniority.');
  46. INSERT INTO Fortune (message) VALUES ('Computers make very fast, very accurate mistakes.');
  47. INSERT INTO Fortune (message) VALUES ('<script>alert("This should not be displayed in a browser alert box.");</script>');
  48. INSERT INTO Fortune (message) VALUES ('フレームワークのベンチマーク');