gpt4 book ai didi

sql - SQL Server 中 session 和连接的区别

转载 作者:行者123 更新时间:2023-12-03 01:06:32 24 4
gpt4 key购买 nike

对于临时表,我们发现它们与连接相关。我的意思是,在一个连接中创建的表仅适用于该连接,并在连接丢失或损坏时自动删除。

SQL Server 中的连接和 session 有什么区别?

最佳答案

连接是物理通信 channel , session 是信息交换的状态。一个连接可以有多个 session 。

The connection is the physical communication channel between SQLServer and the application: the TCP socket, the named pipe, the sharedmemory region. The session in SQL Server corresponds to the Wikipediadefinition of a session: a semi-permanent container of state foran information exchange. In other words the sessions stores settingslike cache of your login information, current transaction isolationlevel, session level SET values etc etc.

Normally there is one session on each connection, but there could bemultiple session on a single connection (Multiple Active ResultSets, MARS) and there are sessions that have no connection (SSBactivated procedures, system sessions). There are alsoconnections w/o sessions, namely connections used for non-TDSpurposes, like database mirroringsys.dm_db_mirroring_connections or Service Broker connectionssys.dm_broker_connections.

我从 here 得到了答案

关于sql - SQL Server 中 session 和连接的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39199173/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com