Understanding SQL Query Optimization – (Part 1)

Most of the activity of the database server is related to queries. Because of this, query optimization is often a major concern. SQL Server tries to optimize query performance itself, but its effectiveness in this may be influenced by several problems. Indexes and poorly designed queries can lead to unacceptable performance, no matter how well you design your database. Key issues related to query optimization include designing indexes, statistics, and index fragmentation. Statistics describe index key values, are maintained for index columns, and are used by SQL Server to decide on the most appropriate index to use when running queries.

Checkout the first of this four part article series here, which gives you an overview of the tools and techniques for SQL Server Query Optimization.

This article is published on SQL-SERVER-PERFORMANCE.COM.

Advertisement

Understanding SQL Server Query Optimization Statistics

SQL Server query optimizer uses statistics to create query plans that improve query performance. For most queries, the query optimizer already generates the necessary statistics for a high quality query plan; in a few cases, you need to create additional statistics or modify the query design for best results. By default, SQL Server maintains statistics for index columns. You can also keep statistics on selected non-indexed columns, if desired. Statistics on non-indexed columns count toward the limit of non-clustered indexes (249) that you can have on a table.

Checkout my article here, in which you’ll learn what query optimisation statistics are and how SQL Server query optimizer uses statistics. You will also learn how to create and manage statistics, and what are the different ways to determine when statistics were last updated in SQL Server.

This article is published on SQL-SERVER-PERFORMANCE.COM.