SQL SERVER - OS Threads Used by SQL Scheduler - SQL Authority with Pinal Dave
source link: https://blog.sqlauthority.com/2021/05/07/sql-server-os-threads-used-by-sql-scheduler/?utm_campaign=sql-server-os-threads-used-by-sql-scheduler
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
SQL SERVER – OS Threads Used by SQL Scheduler
Today we will answer the question asked by my client during Comprehensive Database Performance Health Check, about OS Threads Used by SQL Scheduler. Well, let us see a simple script for the same, which I had earlier blogged SQL SERVER – Simple Script to Match Session ID to OS Thread ID.
SELECT
osTask.session_id, osThreads.os_thread_id,
osTask.scheduler_id, osTask.task_state
FROM
sys.dm_os_tasks
AS
osTask
INNER
JOIN
sys.dm_os_threads
AS
osThreads
ON
osTask.worker_address = osThreads.worker_address
WHERE
osTask.session_id
IS
NOT
NULL
ORDER
BY
osTask.session_id;
GO
When you run the script above it will give you a result similar to the following image.
Using this simple script you can easily figure out which OS Threads are used by SQL Server. Additionally, you can know the scheduler_id and session_id along with it. Well, a short blog post for today. Let me know your thoughts about it in the comments section. I try to reply to each comment.
Let me know if you are interested to know more about this topic. I will write more blogs as well as create an SQL in Sixty Seconds video.
Here are my few recent videos and I would like to know what is your feedback about them.
Reference: Pinal Dave (http://blog.SQLAuthority.com)
Pinal Dave is an SQL Server Performance Tuning Expert and independent consultant with over 17 years of hands-on experience. He holds a Masters of Science degree and numerous database certifications.
Pinal has authored 12 SQL Server database books and 37 Pluralsight courses. To freely share his knowledge and help others build their expertise, Pinal has also written more than 5,500 database tech articles on his blog at https://blog.sqlauthority.com.
Pinal is an experienced and dedicated professional with a deep commitment to flawless customer service. If you need help with any SQL Server Performance Tuning Issues, please feel free to reach out at [email protected].
Pinal is also a CrossFit Level 1 Trainer (CF-L1) and CrossFit Level 2 Trainer (CF-L2).
Nupur Dave is a social media enthusiast and an independent consultant. She primarily focuses on the database domain, helping clients build short and long term multi-channel campaigns to drive leads for their sales pipeline.
Exclusive Newsletter
Is your SQL Server running slow and you want to speed it up without sharing server credentials? In my Comprehensive Database Performance Health Check, we can work together remotely and resolve your biggest performance troublemakers in less than 4 hours.
Once you learn my business secrets, you will fix the majority of problems in the future.
Have you ever opened any PowerPoint deck when you face SQL Server Performance Tuning emergencies? SQL Server Performance Tuning Practical Workshop is my MOST popular training with no PowerPoint presentations and 100% practical demonstrations.
Essentially I share my business secrets to optimize SQL Server performance.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK