SQL INSERT performance omitting field names?

后端 未结 3 1631
南方客
南方客 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 05:50

    No, it's not faster. The database has to check which fields are in the table and match against the values anyway.

    You should always specify the fields in the query to make the code more robust. If someone changes the order of the fields in the table, it stops working (or worse writes the data in the wrong field) if you haven't specified the fields.

提交回复
热议问题