Jeremy Roy
Jeremy Roy

Reputation: 1291

Does the order of columns in a select statement affect query speed?

For example, I have a database like this:

id | fname | lname | sex | age | tel | cell | address

If I do select cell, fname, address, sex instead of doing select fname, sex, cell, address, will that affect the speed of query, in big tables?

I did a quick check in phpmyadmin and it appeared to be taking same time, but I wanted to double check.

Thanks.

Upvotes: 4

Views: 345

Answers (3)

Corey
Corey

Reputation:

Another thing that will make it run faster is creating indexes on the fields that you will be searching the most.

Upvotes: 1

Denis de Bernardy
Denis de Bernardy

Reputation: 78413

It won't affect it the slightest bit.

Upvotes: 1

SLaks
SLaks

Reputation: 887215

That won't make any difference.

However, omitting columns from the SELECT clause will make it run faster since it'll send less data over the network.

Upvotes: 9

Related Questions