December 2, 2020 at 6:33 am
I have some questions about sys.sysprocesses/sys.dm_exec_sessions and sys.dm_exec_requests, please kindly give your guidance and comments, thanks!
1. under Microsoft SQL server Management Studio, when I execute select * from sys.dm_exec_sessions and select * from sys.sysprocesses, they have same pieces of records,
so spid of sys.sysprocesses is the same thing with the session_id of sys.dm_exec_sessions, is it right?
2. what is the relationship between sys.dm_exec_sessions and sys.sysprocesses ? and what is the similarity and difference between them ?
3. when we log in SQL Server successfully, then it will establish a session? but when we click new query, it seems to create a new session, so what is session_Id and request_id?
and what is the difference between session_id and request_id ?
December 2, 2020 at 1:10 pm
The documentation contains all that you need to know, with probably the exception of what request_id means.
sys.sysprocesses - old 2000 view, don't use it, it will be removed in a later version of sql (if they ever do), use sys.dm_exec_sessions instead
sys.sysprocesses & sys.dm_exec_sessions, similarities and differences, check out each one on their document page
you join sessions to requests on the session_id on each table, request ID is to say which active record set is being worked on with connections with MARS enabled
SESSION_ID = SPID
REQUEST_ID = MARS ID (it not MARS enabled value is 0)
December 8, 2020 at 3:43 am
well noted, thank you Ant-Green!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply