Making TENS test tables in MySQL database

Source: Internet
Author: User

In order to facilitate the performance of testing, table and other work, it is necessary to establish 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 insert speed is much faster than InnoDB way) data table description Data Volume: 10 million field type: ID: Number uname: Username Ucreatetime: Creation time Age: Create TABLE USERTB (ID Serial, uname varchar (), ucreatetime datetime, age int (one)) Engine=myisamdefault CHARACTER Set=utf8 Collate=utf8_gene Ral_ci auto_increment=1 row_format=compact;2 Create insert data stored procedure delimiter $ $SET autocommit = 0$$
CREATE PROCEDURE test1 () Begindeclare v_cnt decimal () default 0;dd: Loop insert INTO USERTB values (null, ' User 1 ', ' 2010-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 Execute stored procedure call test1; time: It takes only 95 seconds to execute with i5 notebook 4 Modify engineer as needed (non-essential steps, if no conversion required) ALTER TABLE USERTB engine= InnoDB, time consuming: 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.