Quantcast
Channel: Database Design forum
Viewing all articles
Browse latest Browse all 2729

Enough changes, still index stats are not getting updated automatically ?

$
0
0

Hello,

I had read that SQL Server invalidates the stats when there are enough changes (20% of total rows in the table +500) in underlying table and AUTO UPDATE STATISTICS option is enabled for database in question and updates the stats automatically when Optimizer needs this info. 

Env: Microsoft SQL Server 2014 (SP2-GDR) (KB3194714) - 12.0.5203.0 (X64)   Sep 23 2016 18:13:56   Copyright (c) Microsoft Corporation  Developer Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) 

I copied data from person table into persontest table and created non-clustered index on new table, SQL Server generated stats for this index. Row count was 19+K.

INSERT INTO [Person].[persontest]
SELECT * FROM [Person].[person]

Inserted close to 5K new records in small batches, and checked stats was not updated. Run select query fetching all records from table, stats still remained same.  Executed DBCC FREEPROCCACHE() and inserted another set of rows, no change on stats update time.

Enabled Actual execution plan and couldn't see any difference between actual number of rows and estimated number of rows. Fired select query and checked again, stats are still not updated. Till now 15K+ records have been added but still stat is not getting updated. 

I am clueless about it - appreciate your insight and thought on this topic.

Thank you.


Viewing all articles
Browse latest Browse all 2729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>