Skip to content

Update sys-dm-db-task-space-usage-transact-sql.md#6783

Closed
sqlgt0 wants to merge 1 commit intoMicrosoftDocs:livefrom
sqlgt0:patch-1
Closed

Update sys-dm-db-task-space-usage-transact-sql.md#6783
sqlgt0 wants to merge 1 commit intoMicrosoftDocs:livefrom
sqlgt0:patch-1

Conversation

@sqlgt0
Copy link
Copy Markdown

@sqlgt0 sqlgt0 commented Sep 6, 2021

From To Relationship
dm_db_task_space_usage.request_id dm_exec_requests.request_id Many-to-one

The combination of session_id + request_id in sys.dm_db_task_space_usage might not always be unique in the scenario when parallel thread is spun using the same request_id as per the attached screenshot. In this situation, you would need to filter the sys.dm_db_task_space_usage DMV with exec_context_id = 0 to show only the active row.

|From|To|Relationship|  
|----------|--------|------------------|  
|dm_db_task_space_usage.request_id|dm_exec_requests.request_id|Many-to-one|  

The combination of session_id + request_id in sys.dm_db_task_space_usage might not always be unique in the scenario when parallel thread is spun using the same request_id as per the attached screenshot. In this situation, you would need to filter the sys.dm_db_task_space_usage DMV with exec_context_id = 0 to show only the active row.
@PRMerger9
Copy link
Copy Markdown
Contributor

@sqlgt0 : Thanks for your contribution! The author(s) have been notified to review your proposed change.

@sqlgt0
Copy link
Copy Markdown
Author

sqlgt0 commented Sep 6, 2021

The combination of session_id + request_id in sys.dm_db_task_space_usage might not always be unique in the scenario when parallel thread is spun using the same request_id as per the attached screenshot. In this situation, you would need to filter the sys.dm_db_task_space_usage DMV with exec_context_id = 0 to show the parent row.

image

@WilliamDAssafMSFT
Copy link
Copy Markdown
Contributor

Thanks @sqlgt0 for contacting Microsoft with feedback about our product documentation. We'll consider a suggestion like this for applied query samples where this scenario would come into play. We'll contact you if we need further information, and you'll receive an email message each time we "@mention" you in a comment.

Thanks again for submitting your feedback. Your suggestions help improve our documentation.

@sqlgt0
Copy link
Copy Markdown
Author

sqlgt0 commented Sep 8, 2021

dm_db_task_space_usage.docx

Put a more descriptive statement where the session_id + request_id relationship between sys.dm_db_task_space_usage and sys.dm_exec_requests will not be 1-to-1 when the same task runs in parallel. A lot of our company monitoring tool assume the 1-to1 relationship and we're getting lots of errors due to duplicates. Unless the statement is more clear, our engineers are having a hard time to explain why we need to update our code because it goes against this official Microsoft documentation. I'd really appreciate if this scenario is properly reflected in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants