is there a performance difference between
$a = mysql_query("SELECT * FROM table WHERE id = 1 AND text = 'test'");
and
$a = mysql_query("SELECT * FROM `table` WHERE `id` = '1' AND 'text' = 'test'");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, backticks do not affect performance. They are used to escape reserved words, but you are free to wrap all your table and column names with backticks if you prefer.
I’m not sure if it is a typo, but your second example is not equivalent to the first one when it comes to the
'text' = 'test'part in theWHEREclause. The first will try to match the'test'value to thetextcolumn, while the second one will always return false since'text'is not equal to'test'.