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 c12b232

Browse files
Merge pull request #381 from EmergentSoftware/dev
Added IndexName
2 parents 511396f + f324a63 commit c12b232

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Development Application Settings/Red Gate/SQL Prompt/Snippets/buf-7363fb6d-c728-4633-ae8d-464db1b80a4e.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"id": "7363fb6d-c728-4633-ae8d-464db1b80a4e",
33
"prefix": "buf",
44
"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;"
66
}

0 commit comments

Comments
(0)

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