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
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
No comments:
Post a Comment