开发者

Parenthesis() and SQL Query Performance

开发者 https://www.devze.com 2023-02-21 09:28 出处:网络
In a where statement, does adding unnecessary parentheses ( ) affect SQL performance? Example: SELECT * FROM table

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...

0

精彩评论

暂无评论...
验证码 换一张
取 消