I execute queries in SQL Server management studio for query tuning– showing a return time different to other client applications. It’s difficult to know whether it’s the database engine or SSMS which might be causing a problem. Where is the delay , is it the database engine or is t SSMS? As a DBA it is difficult to isolate just the query.
A simple technique to use is to return the resultset into local variables. This does a fairly decent job of discounting the SSMS application cost of iterating and displaying the recordset.
This way you can focus just on executing the query and analysing the Execution Plan
---Normally I’d run a statement and allow SSMS to iterate through the resultset select name,id,xtype from sys.sysobjects --push the results into local variables declare @name nvarchar(128),@id int,@xtype char(2) select @name = name,@id = id,@xtype = xtype from sys.sysobjects
Read More
What is SQL Server Query Tuning? - SQL Server DBA
SQL Server – Find high impact queries with sys.dm_exec_query_stats