mysql - Optimization of INSERT Query in SQL -


i investigating on comparing effectiveness of 2 ways of insert data in sql know executes faster

the first 1 is

insert mytb(id, name)    select 0, 'uyen' union    select 1, 'uyen' union    ....    select 1000, 'uyen' 

and second 1 is:

insert mytb(id, name) values (0,'uyen'); insert mytb(id, name) values (1,'uyen'); .... insert mytb(id, name) values (1000,'uyen'); 

i have tried executing 1000 rows. runs faster , other runs faster (i think because resources of system different in every execution or other issues). did search around internet without success. please me give answer , explain reasons. want know optimization queries.

thanks


Comments

Popular posts from this blog

php - Wordpress: Link a post to posts of another category manually -

delphi xe7 upload/download dropbox file using the rest client and show progress -

java - Get more than One value and display it -