10-11-2011, 01:58 PM
When using Select queries, does it really matter that much if you always use;
SELECT * from table
SELECT item1, item2 FROM table
Does this greatly affect the speed the query is processed?
10-11-2011, 07:45 PM
If the table(s) have many large fields, then doing SELECT * could be much slower than selecting individual fields *IF* when you selected individual fields you did *NOT* include all the large one.
Consider: MySQL is in a separate process than whatever you use to invoke it (PHP or any other code...even the command line client). So whatever data you SELECT has to be sent through some sort of inter-process communication from MySQL to the client. Inter-process data transfer is much slower than in-process. The more data you pass, the longer it takes.
So even if there were zero overhead within MySQL (and there's more than zero! often not a lot more,but...) the time it takes to pass data from one process to the other could add up.
General rule: SELECT only what you need for best performance.