Parenthesis() and SQL Query Performance
In a where statement, does adding unnecessary parentheses (
)
affect SQL performance?
Example:
SELECT * FROM table
WHERE (name='J开发者_如何学JAVAohn') 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. :)
No performance degradation for the parenthesis... the sql sintax couldn't degrade the performance of a query, if is definitely correct...
精彩评论