20 likes | 59 Views
Unlike the statistics for traditional disk-based tables, statistics for memory optimized tables (MOTs) don’t get updated automatically. Should we start configuring a new job to periodically update statistics for MOTs? Not necessarily.
E N D
SQL 2014 MEMORY - OPTIMIZED TABLES (MOTS) AND STATISTICS Unlike the statistics for traditional disk-based tables, statistics for memory optimized tables (MOTs) don’t get updated automatically. Should we start configuring a new job to periodically update statistics for MOTs? Not necessarily. If the MOTs are being accessed only by traditional interpreted Stored Procedures, we should update the statistics whenever significant data changes occur (DML – delete, update and insert operations). However, if MOTs are being accessed only by natively compiled stored procedures, just updating the statistics will not help – you should also drop and recreate the natively compiled stored procedures for them to make use of newly updated statistics. There are many other caveats when updating statistics for MOTs (See http://msdn.microsoft.com/en-us/library/dn232522.aspx for more information): NORECOMPUTE clause must be specified when updating stats for MOTs to disable automatic stats update Sp_updatestats against MOTs always updates the stats regardless of any table updates MOTs only support FULLSCAN updates After any major data loading/changes into MOTs, native compiled stored procedures need to be recompiled (droped and recreated). Note that all native compiled stored procedures are recompiled when a database is restarted (offlined then onlined) or when a server is restarted Satish Kartan has been working with SQL Server for the past 20 years. To read more, please visit Satish Kartan's blog at http://www.sqlfood.com/ where he has shared more details on this.