Search code examples
c#t-sqlpostgresqlperformance-testingmultiple-resultsets

TSQL equivalent of PostgreSQL "PERFORM" keyword?


I'm testing query performance in a loop. Rather than return a hundred duplicates of a result set, I want to run a select statement hundreds of times, discarding the results each time.

PostgreSQL has the syntax "perform select...", which will execute the select statement and discard the results. "37.6.2. Executing a Query With No Result" http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html

Is there an equivalent keyword in TSQL?

I'm aware that SSMS has a "Discard results" options, but it appears that the results are not discarded after each iteration and would still accumulate in memory until all iterations are complete. I suppose selecting into a temporary variable could work, but it would be much simpler to just discard the results with a keyword. I'd rather avoid construction of table variable definitions and the potential overhead of storing the results in temporary tables.


Solution

  • I searched through the SQL-92 specification for an equivalent keyword, but I was unable to find any and, in my experiences, don't know of one specific to SQL Server.