QueryStressSettings class contains all configuration options for SQL Query Stress. These settings control test execution, connection behavior, statistics collection, and query parameterization.
Core Test Settings
Number of concurrent threads to use for the load test. Each thread will execute the query independently.The connection pool size is automatically set to
NumThreads * 2 for optimal performance.Number of iterations to run per thread. Each thread will execute the main query this many times.
Delay in milliseconds between query executions within a thread. Set to 0 for no delay.
Query Configuration
The main SQL query to execute during the load test. This is the query that will be stress-tested.
Query to retrieve parameter values for parameterized queries. Results are used to populate parameters in the main query.See Query Parameters for detailed parameter configuration.
Dictionary mapping parameter names to column names from the parameter query results.
Connection Settings
Connection timeout in seconds. Applied to both main and parameter database connections.Minimum value is 15 seconds (automatically adjusted if set to 0).
Command execution timeout in seconds. Set to 0 for unlimited timeout.
Enable or disable connection pooling. When enabled, connections are reused for better performance.
Connection information for the database where the main query will be executed.See Connection Options for detailed connection configuration.
Connection information for the database from which to retrieve parameter values.Only required if using parameterized queries with
ParamQuery.When true, the parameter database uses the same connection settings as the main database.Set to false if parameter values should be retrieved from a different database.
Statistics Collection
Collect I/O statistics including logical reads during query execution.When enabled, sets
SET STATISTICS IO ON before each query execution.Collect timing statistics including CPU time and elapsed time during query execution.When enabled, sets
SET STATISTICS TIME ON before each query execution.Execution Behavior
Force the client to retrieve all data from the result set.When true, uses
ExecuteReader() and iterates through all rows. When false, uses ExecuteNonQuery() for better performance.Cancel active SQL commands immediately when the test is cancelled.When true, does not wait for queries to complete naturally. A timer checks every 2 seconds and calls
SqlCommand.Cancel() if cancellation is pending.Complete Configuration Example
Default Values
TheQueryStressSettings constructor initializes the following defaults:
| Property | Default Value |
|---|---|
| ShareDbSettings | true |
| MainQuery | "" (empty string) |
| ParamQuery | "" (empty string) |
| NumThreads | 1 |
| NumIterations | 1 |
| ConnectionTimeout | 15 |
| CommandTimeout | 0 (unlimited) |
| EnableConnectionPooling | true |
| CollectIoStats | true |
| CollectTimeStats | true |
| ForceDataRetrieval | false |
| KillQueriesOnCancel | true |
| MaxPoolSize | NumThreads * 2 |