I am updating tables with millions of records and I need to be as efficient as possible. Does it make sense to add more criteria to the where clause rather than help?
For example, if you know, I want to set the column to 3, I could use this query:
update mytable set col = 3
Or I could update the record only if it is different
update mytable set col = 3 where col <> 3
I could also filter it so that it only updates records added since the last start of this process
update mytable set col = 3 where col <> 3 and createDate > @lastRunDate
And maybe I could look for extra things in extra columns.
I think my question is, is there a point where the cost of finding additional columns outweighs the cost of the update itself and if there is a principle that you can use to determine where to draw a line.
Update
, , . , :
, , , .
, .
, , , ... [[ . where?]]
# 2 , .
"col", ; , . , , ( , ).
usnig WHERE , . , SQL Server. , ......
: WHERE - , /. ( ), 100% , . , ( SELECT, , , ).
, , , , , , . , , , , , .
, , . , , , WHERE - . SQL (, , ).
. , - .
where , , .
- , , , , , , . , .
Source: https://habr.com/ru/post/1728682/More articles:html 4.0 in XPATH requests - xpathCan I get my own default sorted EntityCollection in EntityFramework? - c #Как использовать полнотекстовый поиск с Linq? - sqlAlternative to triggers in SQL Server - sql-serverWeb project for F # - f #how to create vpn software - c ++Detecting when a user has finished changing a SWT shell - javaдобавление логики "if" в цепочку jQuery - jqueryHow to simultaneously go through two arbitrarily complex tree structures and create a superset? - algorithmSDK problem to convert SDK to SDK file - androidAll Articles