Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 511396f

Browse files
Merge pull request #380 from EmergentSoftware/dev
Added snippet to return information about all the data pages that are...
2 parents f473300 + 834cbff commit 511396f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"id": "7363fb6d-c728-4633-ae8d-464db1b80a4e",
3+
"prefix": "buf",
4+
"description": "ES: Returns information about all the data pages that are currently in the SQL Server buffer pool.",
5+
"body": "/* Returns information about all the data pages that are currently in the SQL Server buffer pool. */\r\nSELECT\r\n SchemaName = '.All'\r\n ,TableName = '.All'\r\n ,CachedPagesCount = FORMAT(COUNT(*), '#,##0')\r\n ,IndexId = -1\r\nFROM\r\n sys.dm_os_buffer_descriptors\r\nWHERE\r\n database_id = DB_ID()\r\nUNION ALL\r\nSELECT\r\n SchemaName = obj.schemaname\r\n ,TableName = obj.tablename\r\n ,CachedPagesCount = FORMAT(COUNT(*), '#,##0')\r\n ,IndexId = obj.index_id\r\nFROM\r\n sys.dm_os_buffer_descriptors AS bd\r\n INNER JOIN (\r\n SELECT\r\n tablename = OBJECT_NAME(p.object_id)\r\n ,schemaname = OBJECT_SCHEMA_NAME(p.object_id)\r\n ,p.index_id\r\n ,au.allocation_unit_id\r\n FROM\r\n sys.allocation_units AS au\r\n INNER JOIN sys.partitions AS p\r\n ON au.container_id = p.hobt_id\r\n AND (au.type = 1 OR au.type = 3)\r\n UNION ALL\r\n SELECT\r\n tablename = OBJECT_NAME(p.object_id)\r\n ,schemaname = OBJECT_SCHEMA_NAME(p.object_id)\r\n ,p.index_id\r\n ,au.allocation_unit_id\r\n FROM\r\n sys.allocation_units AS au\r\n INNER JOIN sys.partitions AS p\r\n ON au.container_id = p.partition_id\r\n AND au.type = 2\r\n ) AS obj\r\n ON bd.allocation_unit_id = obj.allocation_unit_id\r\nWHERE\r\n bd.database_id = DB_ID()\r\nAND obj.schemaname NOT IN (N'sys') /* Remove this to see system objects and user objects */\r\nGROUP BY\r\n obj.tablename\r\n ,obj.schemaname\r\n ,obj.index_id\r\nORDER BY\r\n SchemaName ASC\r\n ,TableName ASC;"
6+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /