MySQL Forums
Forum List  »  Performance

Re: Query performance
Posted by: Felix Geerinckx
Date: November 07, 2005 04:20AM

miloscup wrote:

> Table2 obtain these colums - `name`, `pass`, `email`, `id`, `other`, `other`
>
> $query1 = "SELECT `name`
> FROM $table2
> ";
>
> $query2 = "SELECT *
> FROM $table2
> ";

Since $query1 retrieves less data from your table, it will always be faster. As a general rule: don't use SELECT * ...

Furthermore, if you have an index on name, MySQL won't even look at your table but retrieve the name from the index, which is even faster.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Views
Written By
Posted
1839
November 07, 2005 03:53AM
Re: Query performance
1305
November 07, 2005 04:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.