INSERT INTO SELECT vs VALUES

Viewed 10225

Although there is no reason (apart maybe from aesthetics) to use INSERT INTO SELECT when inserting a single row in a table, is there any difference between using this and INSERT INTO VALUES?

5 Answers

INSERT INTO ... SELECT Vs INSERT INTO VALUES is one of the unremarkable differences that a level of performance has observed considering tables with large amounts of data: INSERT INTO ... SELECT Locks the table while the insert is being made. therefore the table cannot be used for other processes at the same time.

I had to insert into a table some data about (14000 rows) from a text file that I copied in a query, I added the insert statement and the table was populated in about 30 seconds with 'insert select union all'. It took only 4 seconds if a changed that to 'insert values'. The downside of insert values is that I had to copy paste the insert statement every 1000 rows (because of it's limitation) but that was not so much of a problem. So when you have so many rows you can see the difference between the two...

Related