DP-300 · Question #236
Hotspot Question You have an Azure SQL database. You need to identify whether a delayed query execution is associated to a RESOURCE_SEMAPHORE wait. How should you complete the Transact-SQL…
The correct answer is SELECT: wait_type; FROM: sys.dm_exec_requests. To identify RESOURCE_SEMAPHORE waits, the query must select and group by 'wait_type' from 'sys.dm_exec_requests' to analyze active request wait statistics.
Question
Exhibit
Answer Area
- SELECTwait_typewait_typecontext_infowait_resource
- FROMsys.dm_exec_requestssys.dm_exec_requestssys.dm_exec_connectionssys.dm_db_partition_stats
Explanation
To identify RESOURCE_SEMAPHORE waits, the query must select and group by 'wait_type' from 'sys.dm_exec_requests' to analyze active request wait statistics.
Approach. The task is to complete a T-SQL statement to identify RESOURCE_SEMAPHORE waits associated with delayed query execution in an Azure SQL database.
-
For the
SELECTclause (first dropdown): The correct option iswait_type.- Reasoning: To identify a specific type of wait, such as
RESOURCE_SEMAPHORE, you need to examine thewait_typecolumn. This column categorizes the reason for a session or request waiting.
- Reasoning: To identify a specific type of wait, such as
-
For the
FROMclause (second dropdown): The correct option issys.dm_exec_requests.- Reasoning:
sys.dm_exec_requestsis a Dynamic Management View (DMV) that provides information about each request currently executing on SQL Server, including detailed wait statistics likewait_type,wait_time, andsession_id. This is the appropriate source for active query execution wait information.
- Reasoning:
-
For
TARGET1(GROUP BY clause): The correct selection, inferred from theSELECTclause, iswait_type.- Reasoning: When using an aggregate function like
SUM(wait_time)in theSELECTclause, any non-aggregated columns also present in theSELECTlist must be included in theGROUP BYclause. Sincewait_typeis selected to categorize the wait times, the results must be grouped bywait_typeto correctly sum the wait times for each distinct wait type.
- Reasoning: When using an aggregate function like
Common mistakes.
-
common_mistake. Selecting incorrect options in the dropdowns will lead to an invalid query or a query that does not address the problem statement.
-
Incorrect
SELECTclause choices:context_info: This column holds application-specific context information for a session; it is not used for identifying wait types.wait_resource: While related to waits,wait_resourceprovides the specific resource being waited on (e.g., a memory grant ID, a lock ID, a page ID), not the broad type of wait (likeRESOURCE_SEMAPHORE). The question explicitly asks to identify theRESOURCE_SEMAPHORE wait(the type of wait).
-
Incorrect
FROMclause choices:sys.dm_exec_connections: This DMV provides information about connections, but it lacks the detailed request-level wait statistics (wait_type,wait_time) needed to diagnose execution delays effectively.sys.dm_db_partition_stats: This DMV provides statistics about database partitions (e.g., row counts, used space, I/O), which is completely unrelated to query execution waits andRESOURCE_SEMAPHOREwaits.
-
Incorrect
GROUP BYclause: IfTARGET1were anything other thanwait_type(e.g.,session_id), the query would either be invalid (ifwait_typewas selected but not grouped by) or would aggregate wait times in a way that doesn't answer the specific question of identifying wait types.
Concept tested. The primary concepts tested are SQL Server performance monitoring and troubleshooting using Dynamic Management Views (DMVs), specifically identifying and analyzing wait statistics (wait_type and wait_time) for query execution. It also tests fundamental T-SQL syntax knowledge, including SELECT, FROM, JOIN, WHERE, GROUP BY, and the use of aggregate functions.
Topics
Community Discussion
No community discussion yet for this question.
