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?
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.