sys.dm_exec_sessions shows more than one session when only I am using DB - why?

StackOverflow https://stackoverflow.com/questions/23619420

  •  21-07-2023
  •  | 
  •  

문제

There is a code

SELECT S.session_id, S.login_name, S.status
FROM sys.dm_exec_sessions AS S

enter image description here

Why the result shows so many rows? It sounds like I don't know how to right close management studio...

MSDN says:

Running - Currently running one or more requests

Sleeping - Currently running no requests

how the same user can have sleeping and running status?

Ok ok, I know that this represents standalone seesions, but when new session starts, and when the session ends? Is this all about dissconnect from server?

My first reaction when I saw the output was like "SAY WHAAAT?!"

also the column:

last_successful_logon

returns null for every sessionid

도움이 되었습니까?

해결책

More than likely connection pool in action. If you do search on connection pooling, you can set it to "keep" lots of connections around for you. I think the default is 50. After a few minutes, provided you call con.close if will eventually release them.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top