Returns a table that displays total space in tempdb used by version store records for each database. sys.dm_tran_version_store_space_usage is efficient and not expensive to run, as it does not navigate through individual version store records, and returns aggregated version store space consumed in tempdb per database.
Each versioned record is stored as binary data, together with some tracking or status information. Similar to records in database tables, version-store records are stored in 8192-byte pages. If a record exceeds 8192 bytes, the record will be split across two different records.
Because the versioned record is stored as binary, there are no problems with different collations from different databases. Use sys.dm_tran_version_store_space_usage to monitor and plan tempdb size based on the version store space usage of databases in a SQL Server instance.
|Column name||Data type||Description|
|database_id||int||Database ID of the database.|
|reserved_page_count||bigint||Total count of the pages reserved in tempdb for version store records of the database.|
|reserved_space_kb||bigint||Total space used in kilobytes in tempdb for version store records of the database.|
On SQL Server, requires
VIEW SERVER STATE permission.
The following query can be used to determine space consumed in tempdb, by version store of each database in a SQL Server instance.
SELECT DB_NAME(database_id) as 'Database Name', reserved_page_count, reserved_space_kb FROM sys.dm_tran_version_store_space_usage;
Here is the result set.
Database Name reserved_page_count reserved_space_kb ------------------------ -------------------- ----------- msdb 0 0 AdventureWorks2016 10 80 AdventureWorks2016DW 0 0 WideWorldImporters 20 160