热门文章
联系我们
联系人:寇先生
微信公众号:
SQL Server 数据库查看占用内存最大的表
知识分享不易,转载请标注来源:http://www.blenderkou.top/contents/13/1227.html 版权申明:欢迎转载,但请注明出处。 一些博文中的参考内容因时间久远找不到来源了没有注明,如果侵权请联系我删除。
关键词:SAPBusinessOne,SBO,SAPB1,SQLServer。
如何知道为什么自己的数据库这么大?每个表有多少条数据占了多大内存?
SELECT t.NAME AS TableName, s.Name AS SchemaName, p.rows AS RowCounts, SUM(a.total_pages) * 8 AS TotalSpaceKB, CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceMB, SUM(a.used_pages) * 8 AS UsedSpaceKB, CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB, (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB, CAST(ROUND(((SUM(a.total_pages) - SUM(a.used_pages)) * 8) / 1024.00, 2) AS NUMERIC(36, 2)) AS UnusedSpaceMB FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id INNER JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id INNER JOIN sys.allocation_units a ON p.partition_id = a.container_id LEFT OUTER JOIN sys.schemas s ON t.schema_id = s.schema_id WHERE t.NAME NOT LIKE 'dt%' AND t.is_ms_shipped = 0 AND i.OBJECT_ID > 255 GROUP BY t.Name, s.Name, p.Rows ORDER BY SUM(a.total_pages) desc
扫描二维码,关注我的公众号,第一时间获取文章!
知识分享不易,转载请标注来源:http://www.blenderkou.top/contents/13/1227.html 版权申明:欢迎转载,但请注明出处。 一些博文中的参考内容因时间久远找不到来源了没有注明,如果侵权请联系我删除。
上一篇
SAP HANA 2.0 虚拟机,最低8G内存可运行
下一篇
上一篇:SAP HANA 2.0 虚拟机,最低8G内存可运行
下一篇: