sql - Does it make any difference if columns used only in UPDATE queries are indexed -


Assume that there is int two columns in a SQL server ROWLOCK The values ​​in these two columns are often updated to a single line using the signal and unique line ID which is a PK.

For example

 update  (ROWLOCK) SET SuccessCount = {0}, ErrorCount = {1} Record something with = {2}   

If successCount and error code are not used in any SELECT questions, if it is two columns In the non-compressed index, it has been added to SomeTable , does it matter?

There is meta data about an index table

An index on the data also Which does not search directly anytime (where the index is never used) has an overhead in it because the engine has to maintain the index if these two fields are never searched directly, then these Index with columns means zero.

The index should be added only when lowering the cost of the gain index (frequency and time savings) than the cost of maintaining an index (add, update or delete overhead)

In this case, there will never be any benefit in the case because they are never searched directly. Thus, the net cost; No savings ... do not do that.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -