Unique key and LIMIT 1

If I query a column by a unique key, then I don’t need to use “LIMIT 1” for better performance?
I don’t mean PK but just unique key.

Any lookup involving a unique key will just return the one row regardless of whether or not you specify LIMIT 1

Leaving off the LIMIT 1 will make the code more portable as that is a mySQL only instruction.

Ok, thanks, so I add LIMIT 1 too, as you suggested.

Errmm, where was that suggested?

oops, my bad English. “Leaving off” means “keep” or means “remove”?

IIt means don’t put it there to start with. If you already put it there then remove it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.