Possible Duplicate:
Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc
I have a question about performance in MySQL. Before the start sorry for my bad English.
It’s the question: what is performance differences between asterisk and field names in comma separated.
For example: a have a table in “example_table” named and 5 fields “f1, f2, f3, f4, f5” named.
select * from `example_table`;
or
select f1, f2, f3, f4, f5 from `example_table`;
Thanks for replies.
If you select all fields there will be no measurable performance difference.
This improves code readability, as you know exactly which fields the query will return.
If you don’t select all fields the second form will have a slightly better performance because MySQL will send less data on the network.
This may also cause less disk reads if the table contains TEXT or BLOB columns and you don’t ask these columns. These types are not stored directly in the rows, so this would avoid some extra disk reads.
There will be no measurable performance difference if you select all fields, though.