SQL Server administration and T-SQL development, Web Programming with ASP.NET and Javascript, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software

Kodyaz Development Resources

Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Vista, etc.






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.


Free SQL Comparison tools
Trusted by thousands of users
Download your copy now



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
go
set statistics io on
go
set statistics profile on
go

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

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

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






Follow Kodyaz on Twitter

Related SQL Resources

SQL Server Articles

SQL Server 2012

SQL Server Tools

SQL Blog

SQL Server 2008 Blog

Certification Exams Blog

Reporting Services Blog

Analysis Services Blog

MS SQL Server Forums



Free Exam Vouchers










Copyright © 2004 - 2012 Eralper Yilmaz. All rights reserved.
Community Server, by Telligent Systems