Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
Returns the number of pages allocated and deallocated by each session for the database.
This view is applicable only to the tempdb database.
To call this from Azure Synapse Analytics or Analytics Platform System (PDW), use the name sys.dm_pdw_nodes_db_session_space_usage. This syntax is not supported by serverless SQL pool in Azure Synapse Analytics.
|Column name||Data type||Description|
session_id maps to session_id in sys.dm_exec_sessions.
|user_objects_alloc_page_count||bigint||Number of pages reserved or allocated for user objects by this session.|
|user_objects_dealloc_page_count||bigint||Number of pages deallocated and no longer reserved for user objects by this session.|
|internal_objects_alloc_page_count||bigint||Number of pages reserved or allocated for internal objects by this session.|
|internal_objects_dealloc_page_count||bigint||Number of pages deallocated and no longer reserved for internal objects by this session.|
|user_objects_deferred_dealloc_page_count||bigint||Number of pages which have been marked for deferred deallocation.
Note: Introduced in service packs for SQL Server 2012 (11.x) and SQL Server 2014 (12.x).
|pdw_node_id||int||Applies to: Azure Synapse Analytics, Analytics Platform System (PDW)
The identifier for the node that this distribution is on.
On SQL Server and SQL Managed Instance, requires
VIEW SERVER STATE permission.
On SQL Database Basic, S0, and S1 service objectives, and for databases in elastic pools, the server admin account, the Azure Active Directory admin account, or membership in the
##MS_ServerStateReader## server role is required. On all other SQL Database service objectives, either the
VIEW DATABASE STATE permission on the database, or membership in the
##MS_ServerStateReader## server role is required.
IAM pages are not included in any of the allocation or deallocation counts reported by this view.
Page counters are initialized to zero (0) at the start of a session. The counters track the total number of pages that have been allocated or deallocated for tasks that are already completed in the session. The counters are updated only when a task ends; they do not reflect running tasks.
A session can have multiple requests active at the same time. A request can start multiple threads, tasks, if it is a parallel query.
The following objects are included in the user object page counters:
User-defined tables and indexes
System tables and indexes
Global temporary tables and indexes
Local temporary tables and indexes
Tables returned in the table-valued functions
Internal objects are only in tempdb. The following objects are included in the internal object page counters:
Work tables for cursor or spool operations and temporary large object (LOB) storage
Work files for operations such as a hash join
Dynamic Management Views and Functions (Transact-SQL)
Database Related Dynamic Management Views (Transact-SQL)