Making TENS test tables in MySQL database

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.