HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Does the order of columns has a significant effect on INSERT?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
effecttheorderinsertcolumnshasdoessignificant

Problem

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

Context

StackExchange Database Administrators Q#15664, answer score: 12

Revisions (0)

No revisions yet.