Does the order of columns has a significant effect on INSERT?
-
22-10-2019 - |
Question
Do we experience a noticeable difference in performance for these two queries?
INSERT INTO table (col1, col2, col3, col4, col5) ...
and
INSERT INTO table (col5, col3, col1, col2, col4) ...
Do we need to arrange INSERT
columns according to the order of columns in the table?
Solution
No, you don't need to gave the columns in the same order. Not least, table order may not reflect actual on-disk order (this is 100% true for SQL Server, and I'm sure MySQL is the same)
Unless your OCD itch needs scratched
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange