1

I want to test performance of some queries by executing it multiple times in SQL Server Management Studio and comparing statistics. My problem is that this method isn't accurate because after every query result is displayed and memory use of Management Studio grows up. Important for me is to not increase memory consumption, because return set is large (So I cannot put it to temp table)

I found this question: How to Execute SQL Query without Displaying results but it doesn't fit my needs.

So, is there any way to execute query in SQL Manageement Studio without displaying return data?

Community
  • 1
  • 1
Marek Kwiendacz
  • 9,524
  • 14
  • 48
  • 72

2 Answers2

3

In the options section (under Tools-->Options), go to Query Results-->SQL Server and either "Results to Grid" or "Results to Text".

There is an option box for "Discard results after execution". Click the box.

Now, open another query window and there are no results. I imagine that the results are still being returned from the server, so you have network latency. This should fix the memory problem, though.

You can solve the network latency problem by running SSMS on the same server as the engine.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
0

At the top there is an icon which enables Client statistics. This gives you details of the query executed, proccessing times row counts. It will also auto aggregate this data for you if you run the same query multiple time in sequence, and yes these stats are irrespective of rendering times.

Image of the 'include client statistics' icon

Dpolehonski
  • 948
  • 6
  • 11