Possible Duplicate:
Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc
Is there a big performance impact in doing a SELECT * FROM
table_name than doing SELECT specific_columns FROM table_name
?
Possible Duplicate:
Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc
Is there a big performance impact in doing a SELECT * FROM
table_name than doing SELECT specific_columns FROM table_name
?
Yes, it affect performances, especially when you select multiple rows. Select only fields you really need.
Let's take a simple username existance check as example:
Why you'd select everything, when you can select only ID? Both doing the job, but selecting only one field is much better solution.
SELECT `id` FROM users WHERE `username` = 'Nikola K.'
rather than:
SELECT * FROM users WHERE `username` = 'Nikola K.'
I would suggest using EXPLAIN to find the best method to suit your needs. I suppose it would depend on how many columns you have in your table.
The following are some useful sites on MySQL Explain:
http://dev.mysql.com/doc/refman/5.0/en/explain.html
Select only what you need! When in development I use *
because it's easier when I don't really know what I'll be needing, but in the final version you really should be specific. Why not?