SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP

SQL Query Performance Optimization using SET Statistics in SQL Server

SQL query performance optimization in SQL Server is a vital task for SQL developers and SQL Server database administrators. Especially if the database application is showing poor performance, for sql performance optimization database professionals should use helping tools to identify poor code, bottlenecks and missconfigured objects in the SQL database.

Configuring database statistics using "SET STATISTICS" is one of the easiest methods and database tools for developers trying to seek what is causing slow performance of a T-SQL code. Either a t-sql script, or a SQL Server object like an SQL view or SQL Server stored procedure the following script will give starting tips for sql query performance optimization task.

Enalbe time, I/O and profile statistics using the following Set Statistics commands.
Then execute the target sql script or sql procedure which you want to optimize.
Then revert back the configuration settings back to original values.

set statistics time on
set statistics io on
set statistics profile on

--- Execute SQL Query or SQL Stored Procedure
EXEC sp_SQLQueryOptimizationSample

set statistics time off
set statistics io off
set statistics profile off

Here is one of the simplest sql query performance optimization tricks that SQL Server developers can use during their daily t-sql tasks.

SQL Server

SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012
MacOS ve SQL Server 2019

Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.