July 2, 2013 at 4:32 pm
My next question while I am in the INDEX zone.
As an example:
I have a large table (4 - 5 million rows) and I have say five NC indexes on the fields being used in WHERE and JOIN clauses for the incoming queries.
If their is never [or minimal] UPDATES on any of the fields in the NC clustered indexes (INCLUDE fields as well) then is it fair to say that their would only be minimal operational overhead related to updating the NC indexes?
i.e UPDATES will happen very frequently to the data in the table but only on non NC indexed fields so only the Clustered index would need to be updated?
I guess their will be other overhead of keeping these indexes INSERTS, query plan compilation, memory used etc?
Obviously maintenance will need to be performed but I am talking about production hours activity.
thanks
July 3, 2013 at 7:08 am
As far as I understand, unless the index is filtered, all inserts/updates/deletes will affect all nonclustered indexes.
Think in a row level, not just on a field level
EDIT - I might be and probably am wrong about the updates though.
July 3, 2013 at 7:35 am
pretty sure SQLSACT is correct;
part of the update process is updating the indexes that are affected, so when the transaction is committed, bit the data itself and the indexes which point to the data are in sync;
only statistics lag behind, and that can be a concern in high transaction situations.
Lowell
July 3, 2013 at 7:43 am
Keep in mind that if you are changing the Clustering key at all with your updates, all nonclustered indexes will be affected as well
July 3, 2013 at 9:00 am
If you are never modifying any of the columns that are in the index, then the index has no update overhead. It'll still add overhead to inserts and deletes, but only updates that change columns in the index key/include have to touch the index.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 3, 2013 at 9:21 am
AFAIK, Gail is correct. If the columns in the NC index are not changed with an update, that index is not touched. No reason to, as there's nothing to update.
July 4, 2013 at 1:35 am
GilaMonster (7/3/2013)
If you are never modifying any of the columns that are in the index, then the index has no update overhead. It'll still add overhead to inserts and deletes, but only updates that change columns in the index key/include have to touch the index.
Hi Gail - Just to confirm, is this part correct?
if you are changing the Clustering key at all with your updates, all nonclustered indexes will be affected as well
July 4, 2013 at 3:59 am
SQLSACT (7/4/2013)
Hi Gail - Just to confirm, is this part correct?if you are changing the Clustering key at all with your updates, all nonclustered indexes will be affected as well
The clustered index key is present in every single nonclustered index, just like any other column for the purposes of updates.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 4, 2013 at 4:01 am
GilaMonster (7/4/2013)
SQLSACT (7/4/2013)
Hi Gail - Just to confirm, is this part correct?if you are changing the Clustering key at all with your updates, all nonclustered indexes will be affected as well
The clustered index key is present in every single nonclustered index, just like any other column for the purposes of updates.
Thanks
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply