Update Statistics

SQL queries tend to perform differently with more or less data, or when information about the object changes. An object that was originally 2MB may now be 2GB; more of the columns of a table might be populated after the initial load, which didn’t have complete information. The information about the database objects and data is used by the database servers to figure out indexes and execution plans for queries.

In both SQL Server and Oracle, statistics are updated by default. In SQL Server, the AUTO_UPDATE_STATISTICS database option, when turned on, will update the statistics when they become stale. You can also run updates manually, using sp_updatestats or UPDATE STATISTICS.

In Oracle, the parameter STATISTICS_LEVEL set to

Get Oracle Database Administration for Microsoft SQL Server DBAs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.