concept give time interval in category sql

appears as: given time interval
SQL Server DMVs in Action: Better Queries with Dynamic Management Views

This is an excerpt from Manning's book SQL Server DMVs in Action: Better Queries with Dynamic Management Views.

Table 2.1. Common terms and their meaning

Term

Description

Ad hoc query A query that isn’t within a stored procedure.
Batch A collection of one or more SQL statements that are run sequentially, typically separated by a GO statement.
Cached plan A query plan that is to be reused. Often synonymous with query plan.
CLR Common Language Runtime.
Data type The type of data a variable can contain, for example, integer or varchar.
DMF Dynamic Management Function.
DMV Dynamic Management View.
DMV snapshot delta Process used to obtain the difference between DMV counter values taken at different times. First a snapshot is made of the relevant DMV counters, a given time interval passes (or a SQL query or batch is run), then another DMV snapshot is taken, and finally the difference between the snapshots is calculated. Useful for determining the effect on the DMVs of a given time interval or query run during that time interval.
Index Data structure used to provide fast access to the underlying data.
I/O Input/output.
Lock Protection mechanism, to prevent inconsistent data.
Query plan Describes, in detail, how the query will be executed. Often synonymous with cached plan.
Script A collection of one or more SQL queries, stored procedures, or a combination of both.
Server instance It’s possible to install multiple instances of SQL Server on a given Windows server. Each of these server instances has its own tempdb and set of DMVs. In the interest of simplicity, I’ll refer to the word server in this book, but typically this will relate to the server instance.
Snippet A collection of SQL statements used to perform a piece of functionality. In this book, it’s synonymous with script.
SSMS SQL Server Management Studio.
Stored procedure A collection of SQL statements wrapped in a container. This provides various advantages such as plan reuse, improved maintenance, and improved security.
T-SQL Transact-SQL; this is Microsoft’s flavor of SQL.

The DMV sys.dm_os_wait_stats is useful for discovering the cumulative effect of the causes of waiting since SQL Server was last rebooted, restarted, or cleared programmatically. But being cumulative, it doesn’t record trend or discreet time interval information. You can use the DMV snapshot approach given in chapter 2 (“Common patterns”) to determine the specific waits that occur when you run a given SQL query or batch of SQL or indeed to determine the waits over a given time period. This should allow you to highlight, and target for investigation and improvement, any waits that occur while you’re running specific SQL queries or for a given time interval.

Figure 6.3. Output showing the most-blocked queries as well as the most-common wait type in a given time interval

You can determine how the performance counters change over a given time period by calculating the difference between two DMV snapshots, taken at the start and end of a time interval. Running the SQL script given here will show how the performance counters change over the given time interval. In this example, the time period is five minutes; you may want to alter this time interval to suit your needs.