Does anyone knows if removing the field names from an INSERT query results in some performance improvements?
I mean is this:
INSERT INTO table1 VALUES (value1, value2, ...)
faster for DB to be accomplished rather than doing this:
INSERT INTO table1 (field1, field2, ...) VALUES (value1, value2, ...)
?
I know it might be probably a meaningless performance difference, but just to know.
I'm usually using MySQL and PostgreSQL as DBs.
No, actually the contrary! At least for Microsoft SQL Server - you didn't specify what database you're talking about.....
If you don't specify the fields, either in a SELECT or an INSERT, then SQL Server's query processor must first go inspect the system catalogs to find out what fields are indeed available.
So I would always recommend to explicitly list the fields you want - on SELECTs as much as on INSERTs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With