Posts

Showing posts from May, 2019

SQL Server Statistics and smart way to update it

Anybody who has worked with SQL Server databases whether be it administrator or developer, knows the significance of having “ statistics ” on a table and how it greatly impacts SQL query performance. Below are some excerpts about “ statistics ” from SQL Server documentation . “ Statistics for query optimization are binary large objects (BLOBs) that contain statistical information about the distribution of values in one or more columns of a table or indexed view. The Query Optimizer uses these statistics to estimate the  cardinality , or number of rows, in the query result. These  cardinality estimates  enable the Query Optimizer to create a high-quality query plan. ” “ Statistics ” is a complex amalgamation of histograms and densities that helps SQL Server Query optimizer correctly estimate number of rows it may fetch and process for each operator in order to generate an optimal or near optimal execution plan . Estimation plays huge role in how much time each operator wil