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
  •  | 
  •  

Domanda

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

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top