Insertintotablevalues (null, & #039; abc & #039;, & #039; 123@qq.com & #039;); insertintotablevalues (null, & #039; abc & #039 ;, & #039; 123@qq.com & #039;); insertintotablevalues (null, & #039; abc & #039;, & #039; 123@qq.com & #039 ;); execute the statement three times and compile the statement three times in mysql... insert into table values (null, 'abc', '2017 @ qq.com ');
Insert into table values (null, 'abc', '2017 @ qq.com ');
Insert into table values (null, 'abc', '2017 @ qq.com ');
Execute this three times and compile it three times in mysql.
Such a statement
Insert into table values
(Null, 'abc', '2017 @ qq.com '),
(Null, 'abc', '2017 @ qq.com '),
(Null, 'abc', '2017 @ qq.com ');
How many times does one compile in mysql? Once Or three times
Reply content:
Insert into table values (null, 'abc', '2017 @ qq.com ');
Insert into table values (null, 'abc', '2017 @ qq.com ');
Insert into table values (null, 'abc', '2017 @ qq.com ');
Execute this three times and compile it three times in mysql.
Such a statement
Insert into table values
(Null, 'abc', '2017 @ qq.com '),
(Null, 'abc', '2017 @ qq.com '),
(Null, 'abc', '2017 @ qq.com ');
How many times does one compile in mysql? Once Or three times
The kernel is not so thorough, so the specific implementation principles of the two are not very clear.
However, it is very certain that batch insert is highly efficient. SQL Parsing is based on statements. Therefore, your first example is to Parse three SQL statements, and the second example is to parse one SQL statement.
In terms of IO consumption, each SQL statement must write a binlog. Therefore, only one batch insert operation is required. If there are many insert statements, the performance difference will be greater.