Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

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.

like image 958
Jeremy Roy Avatar asked Dec 21 '22 13:12

Jeremy Roy


1 Answers

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.

like image 69
SLaks Avatar answered May 24 '23 08:05

SLaks