Possible duplicate:Which is faster / better? SELECT * or SELECT column1, colum2, column3 etc.
I am currently porting an application written in MySQL3 and PHP4 to MySQL5 and PHP5.
In the analysis, I found several SQL queries that use "select * from tablename", even if only one column (field) is processed in PHP. The table has almost 60 columns and has a primary key. In most cases, the only column used is id , which is the primary key.
Will there be a performance improvement if I use queries that explicitly mention column names instead of *? (In this application, there is only one method that needs all the columns, and all other methods return only a subset of the columns)
. , , , - . , 100k , , , , , .
, EXPLAIN, , .
" - ". .
, Will there be any performance boost?. : " . ?"
Will there be any performance boost?
99% "" . , , .
, , of *? -
. , , , MySQL PHP .., , , .
, , , , , id, SQL.
( ) , , , . .
SQL, ( ).
- , BLOB/CLOB, ( 300 ) - , , WHERE, (IMHO) SELECT *
.
. . , . :
SELECT * FROM tabA JOIN tabB on... ORDER BY colX
, tabA colX, colX tabB, .
Of course, using table aliases for all fields will also help prevent breakage.
-Krip