You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Development Application Settings/Red Gate/SQL Prompt/Snippets/buf-7363fb6d-c728-4633-ae8d-464db1b80a4e.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,5 +2,5 @@
2
2
"id": "7363fb6d-c728-4633-ae8d-464db1b80a4e",
3
3
"prefix": "buf",
4
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;"
5
+
"body": "/* Returns information about all the data pages that are currently in the SQL Server buffer pool. */\r\nSELECT\r\n ObjectSchemaName = '.All'\r\n ,ObjectName = '.All'\r\n ,CachedPagesCount = FORMAT(COUNT(*), '#,##0')\r\n ,IndexName = '.All'\r\nFROM\r\n sys.dm_os_buffer_descriptors\r\nWHERE\r\n database_id = DB_ID()\r\nUNION ALL\r\nSELECT\r\n ObjectSchemaName = obj.ObjectSchemaName\r\n ,ObjectName = obj.ObjectName\r\n ,CachedPagesCount = FORMAT(COUNT(*), '#,##0')\r\n ,IndexName = i.name\r\nFROM\r\n sys.dm_os_buffer_descriptors AS bd\r\n INNER JOIN (\r\n SELECT\r\n p.object_id\r\n ,ObjectName = OBJECT_NAME(p.object_id)\r\n ,ObjectSchemaName = 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 p.object_id\r\n ,ObjectName = OBJECT_NAME(p.object_id)\r\n ,ObjectSchemaName = 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\n LEFT JOIN sys.indexes AS i\r\n ON obj.object_id = i.object_id\r\n AND obj.index_id = i.index_id\r\nWHERE\r\n bd.database_id = DB_ID()\r\nAND obj.ObjectSchemaName NOT IN (N'sys') /* Remove this to see system objects and user objects */\r\nGROUP BY\r\n obj.ObjectName\r\n ,obj.ObjectSchemaName\r\n ,i.name\r\nORDER BY\r\n ObjectSchemaName ASC\r\n ,ObjectName ASC;"
0 commit comments