SQL statements like this, MySQL compiles a few times

Source: Internet
Author: User
Insert into table values (NULL, ' abc ', ' 123@qq.com ');
Insert into table values (NULL, ' abc ', ' 123@qq.com ');
Insert into table values (NULL, ' abc ', ' 123@qq.com ');
Do this 3 times, compile 3 times in MySQL

The statements like that
Insert INTO table values
(NULL, ' abc ', ' 123@qq.com '),
(NULL, ' abc ', ' 123@qq.com '),
(NULL, ' abc ', ' 123@qq.com ');
How many times are you compiling in MySQL? 1 times or 3 times.

Reply content:

Insert into table values (NULL, ' abc ', ' 123@qq.com ');
Insert into table values (NULL, ' abc ', ' 123@qq.com ');
Insert into table values (NULL, ' abc ', ' 123@qq.com ');
Do this 3 times, compile 3 times in MySQL

The statements like that
Insert INTO table values
(NULL, ' abc ', ' 123@qq.com '),
(NULL, ' abc ', ' 123@qq.com '),
(NULL, ' abc ', ' 123@qq.com ');
How many times are you compiling in MySQL? 1 times or 3 times.

The kernel is not so thoroughly researched, so the concrete implementation of the two is not particularly clear.

But it is very certain that the bulk insert efficiency is high, SQL parsing is by the statement, so your first example is to parse 3 SQL statements, the second example is to parse 1 SQL statements

From the IO consumption, each SQL statement is written once binlog, so the bulk insert as long as write once, if the insert more, the performance difference will be greater

  • 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.