-2

I know that SELECT * is considered bad practice since it can return un-needed information.

But what about this:

Say i have a table with 4 columns, columns 1-4

Is there any difference (like fast, performance) between these two queries?

SELECT col_1,col_2,col_3,col_4 FROM ...

And

SELECT col_2,col_4,col_1,col_3 FROM ...

FYI : 1st query has same order as database columns,but 2nd query did not care about DB table columns order.

4

3 回答 3

1

For all intents and purposes, no.

于 2013-05-16T03:44:00.173 回答
0

Speed should be the same in both queries.

To ensure this, print a time stamp before and after each query so you can see for yourself.

Best wishes,

于 2013-05-16T03:45:43.013 回答
0

Without a where clause, all the three queries are going to perform the same, assuming that you have listed all the columns in your table. If you have a Primary Key, then these queries are going to do a clustered index scan, otherwise a table scan, which are fundamentally the same thing.

于 2013-05-16T03:45:50.453 回答