Users use email as a user name landing, you need to check out an email corresponding to a record. Each user's email is unique.
SELECT * from T_user WHERE email=?;
The above statement implements a query email corresponding to a user information, but because the email column is not indexed , will result in a full table scan , the efficiency will be very low.
SELECT * from T_user WHERE email=? LIMIT 1;
Plus limit 1, as long as a corresponding record is found, it will not continue to scan downward , the efficiency will be greatly improved.
If the email is an index, you do not need to add the limit 1, if it is based on the primary key to query a record also does not need limit 1, the primary key is also an index.
For example:
SELECT * from T_user WHERE id=?;
There is no need to write:
SELECT * from T_user WHERE id=? LIMIT 1;
There is no difference in efficiency.
MySQL knows only one query result, using limit 1 in SQL statements can improve query efficiency