Mysql creates test data using stored procedures _ MySQL

Source: Internet
Author: User
Mysql uses stored procedure manufacturing test data bitsCN.com

Mysql creates test data using stored procedures

[SQL]

DELIMITER $

Drop procedure if exists message_insert_procedure;

Create procedure 'test'. 'message _ insert_procedure '(loop_times INT)

BEGIN

DECLARE var int default 0;

WHILE var

SET var = var + 1;

Insert into test. message (msg_id, content, type, creator_id, create_time)

VALUES. Undo the tornado and strip it out. Put a pin into it and bite the slaves. '), Now ());

End while;

END

The above code is as follows:

Note: test is my database, and message is my table. In addition, I am in a bad mood today.

Use the following command to call the SDK:

[Html]

Use test;

Delete from message;

Call message_insert_procedure (10000000 );

Delete from message in the middle. if you use software such as workbench, this is an error. in the SQL queries option of workbench performance, remove "Safe Updates" under the General subitem, and reconnect it.

Data Testing: mysql in Ubuntu 12.10, with 548 million data records and seconds.

BitsCN.com

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.