Making a TENS test sheet in MySQL database foreword: Recently prepared to learn more about MySQL, including the characteristics of various engines, performance optimization, sub-table sub-library and so on. In order to facilitate the performance of testing, table and other work, you need to first build a larger data table. I'm going to build a tens of millions of user tables here first. Step:1 Create a data table (MyISAM mode storage insertion speed is much faster than InnoDB method) Data Sheet Description Data Volume: 10 million field type: id : number uname: User name ucreatetime: Creation time Age: CREATE TABLE USERTB ( id serial, uname varchar ( , ucreatetime datetime , age) int (one)) engine=myisam default character set=utf8 collate= utf8_general_ci auto_increment=1 row_format=compact; 2 creating an Insert data stored procedure delimiter $$ set autocommit = 0$$ create procedure test1 () begindeclare v_cnt decimal (Ten) default 0 ; dd:loop insert into usertb values (NULL, ' User 1 ', ' 2010-01-01 00:00:00 ', '), (null, ' User 2 ', ' 2010-01-01 00:00:00 ',, (null, ' User 3 ', ' 2010-01-01 00:00:00 ', '), (null, ' User 4 ', ' 2010-01-01 00:00:00 ', '), (NULL, ' User 5 ', ' 2011-01-01 00:00:00 ',, (NULL, ' User 6 ', ' 2011-01-01 00:00:00 ', '), (null, ' User 7 ', ' 2011-01-01 00:00:00 ', '), (NULL, ' User 8 ', ' 2012-01-01 00:00:00 ', '), (NULL, ' User 9 ', ' 2012-01-01 00:00:00 ',, (null, ' user 0 ', ' 2012-01-01 00:00:00 ') ; commit; set v_cnt = v_cnt+10 ; if v_cnt = 10000000 then leave dd; end if; end loop dd ; end; $$ delimiter ; 3 Executing stored procedures call test1; Time: It takes only 95 seconds to execute with i5 's notebook 4 modify engineer as needed (non-essential steps, if no conversion is required) alter table usertb Engine=innodb; time: It takes only 200 seconds to execute with a i5 notebook
Making TENS test tables in MySQL database