SQL INSERT performance omitting field names?

后端 未结 3 1635
南方客
南方客 2021-02-20 05:13

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 (v         


        
3条回答
  •  梦谈多话
    2021-02-20 06:09

    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.

提交回复
热议问题