View Single Post
Old 09-17-2007, 04:56 PM   #9 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
About LIMIT 0,1... why? :S I gather the row where `u_id` = $u_id so I only get 1 row anyways..
To be honest, omitting the LIMIT 0, 1 in this case would not matter if the ID is a primary key that is set to unique. MySQL knows it's unique and it knows to find only 1. However, if you were acquiring the record via a non-unique index then LIMIT 0, 1 would prevent MySQL from trawling through your entire table looking for others that match your criteria. Therefore speeding up the query considerably.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote