In a where statement, does adding unnecessary parentheses ( ) affect SQL performance?
Example:
SELECT * FROM table
WHERE (name='John') AND (age='30')
AND (address='Some Street') AND (height='510')
No, not in any way that is significant.
The query is parsed once, at which stage some extra parentheses could mean a marginal difference in execution time, but you would have to have a whole lot of parentheses before that would even be possible to measure.
Once the query is parsed and execution starts, it will behave exactly the same as one that had no unneccesary parentheses. Only the actual operations are left.
There's no difference. Perhaps you'll save a few nanoseconds of parsing overhead one way or the other, but srsly. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With