Updates statistics (rowcount and distinct count) for given table.

If possible, it uses native statistics mechanism of underlying database provider. If configuration allows usage of approximate row count, tries to use approximate count function. In other case uses regular SQL queries (COUNT and DISTINCT) to gather needed information.

Respects table and column statistics configuration.


lyft_update_object_statistics 'databaseName', 'schemaName', 'tableName' [;]



Name of the database in which table is present.


Name of database's schema in which table is present.


Name of a table which statistics are to be updated.


Updates objects statistics for AdventureWorksDW2012_mssql.dbo.DimDate.

EXEC lyft_update_object_statistics @databaseName = 'AdventureWorksDW2012_mssql', @schema_name = 'dbo', @tableName = 'DimDate';

See Also