Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Overhead on a NC index if the key fields are not updated during production. Expand / Collapse
Author
Message
Posted Tuesday, July 2, 2013 4:32 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, September 24, 2014 1:40 PM
Points: 100, Visits: 500
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


Post #1469789
Posted Wednesday, July 3, 2013 7:08 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 22, 2014 4:37 AM
Points: 1,379, Visits: 2,688
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.
Post #1470036
Posted Wednesday, July 3, 2013 7:35 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 11:31 AM
Points: 12,901, Visits: 32,136
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1470052
Posted Wednesday, July 3, 2013 7:43 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 22, 2014 4:37 AM
Points: 1,379, Visits: 2,688
Keep in mind that if you are changing the Clustering key at all with your updates, all nonclustered indexes will be affected as well
Post #1470056
Posted Wednesday, July 3, 2013 9:00 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 11:14 AM
Points: 39,964, Visits: 36,319
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1470097
Posted Wednesday, July 3, 2013 9:21 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:18 AM
Points: 31,078, Visits: 15,522
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.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1470117
Posted Thursday, July 4, 2013 1:35 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 22, 2014 4:37 AM
Points: 1,379, Visits: 2,688
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


Post #1470332
Posted Thursday, July 4, 2013 3:58 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 11:14 AM
Points: 39,964, Visits: 36,319
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1470379
Posted Thursday, July 4, 2013 4:01 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, September 22, 2014 4:37 AM
Points: 1,379, Visits: 2,688
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
Post #1470382
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse