sqlserver查看缓存中数据页面和索引页面
2012-03-17 21:45
295 查看
--语句参考msdn和网络文章
select
count(*)as cached_pages_count,
sum(bd.row_count) row_count,
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc
select
count(*)as cached_pages_count,
sum(bd.row_count) row_count,
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc
相关文章推荐
- 查看SQLSERVER内部数据页面的小插件Internals Viewer
- 查看SQLSERVER内部数据页面的小插件Internals Viewer
- 查看SQLSERVER内部数据页面的小插件Internals Viewer
- 查看SQLSERVER内部数据页面的小插件Internals Viewer(续)
- 在Web服务器磁盘上缓存数据和HTML页面
- oracle 如何查看一个数据表的 约束,索引
- Sqlserver 2005+:查看索引【index】的【碎片】
- 清除SQL Server数据缓存和执行计划缓存,查看执行计划的各种方式对比
- 清除SQL Server数据缓存和执行计划缓存,查看执行计划的各种方式对比
- 在Asp.net 2.0 中禁用页面缓存解决页面刷新(重新加载数据)的问题
- SQLSERVER如何查看索引缺失
- 利用sys.dm_db_index_physical_stats查看索引碎片等数据
- 让FireFox 禁用缓存,实时查看最新页面(转)
- 清除SQL Server数据缓存和执行计划缓存,查看执行计划的各种方式对比
- 查看SqlAzure和SQLServer中的每个表数据行数
- 补漏学习:在Web服务器磁盘上缓存数据和HTML页面
- 页面的数据缓存,包括文字和图片
- window.showModalDialog方式/模式窗口数据不刷新(缓存)问题/模式窗口中,链接弹出新窗口问题/无提示关闭页面的方法
- SQLserver数据文件(MDF)的页面文件头结构剖析
- SQL数据缓存依赖 [SqlServer | Cache | SqlCacheDependency ]