At work we've been hacking away at a stored procedure and we noticed something.
For one of our update statements, we noticed that if the values are the same as the previous values we had a performance gain.
We were not saying
UPDATE t1 SET A=5
where the column was already was equal to 5. We were doing something like this:
UPDATE t1 SET A = Qty*4.3
Anyway, is SQL Server smart enough not to do the operation if the values evaluate to the same in an UPDATE operation or am I just being fooled by some other phenomena?
Yes you will see some performance gains. I recommend reading this article to get a better understanding (it will explain why much better than I can):
https://sqlkiwi.blogspot.com/2010/08/the-impact-of-non-updating-updates.html