8

Assume we have a table:

|   col1   |   col2   |   ....  |  coln   |
-------------------------------------------
|    -     |    -     |    -    |    -    | 
|    -     |    -     |    -    |    -    | 
|    -     |    -     |    -    |    -    | 
-------------------------------------------

a query where the columns are ordered:

$query1 = "SELECT col1, col2, col3, col4, col5, ..., coln FROM table";

and a query where the columns are unordered:

$query2 = "SELECT col180, col1, col78, col13, col930, col2 FROM table";

Is one of the queries faster than the other? Why would it be faster? Or, why isn't one faster?

qsi
  • 683
  • 1
  • 7
  • 16

1 Answers1

7

It should make a very small impact on performance. Here is a previous answer by spencer7593 that explains in detail:

The order of columns in a table will have a very small impact on performance, as compared to the performance impact of your database design (entities, attributes and relationships), your transaction design and your query design.

AhDev
  • 486
  • 11
  • 16
  • 3
    It should be "a very small impact on performance", NOT a noticeable difference!!! – V G Apr 15 '14 at 13:10
  • ^^ What I meant. My apologies. I edited my response. – AhDev Apr 15 '14 at 13:25
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – neubert Apr 15 '14 at 13:40
  • Very good point @neubert. I have edited the response. Thank you. – AhDev Apr 15 '14 at 13:44