admin管理员组文章数量:1032785
有关statistics
-- 1 查看/修改 数据库auto create statistics选项值 sp_dboption 'CommunityServer', 'auto create statistics' sp_dboption 'CommunityServer', 'auto create statistics', 'TRUE'
-- 2 查看表中索引index或统计collection的分布统计信息 DBCC SHOW_STATISTICS ('cs_Sections', '_WA_Sys_ParentID_7D0E9093')
-- 3 为某表更新统计信息 -- 本示例仅更新表 authors 的索引 au_id_ind 的分发信息 UPDATE STATISTICS authors au_id_ind
-- 4为数据库中所有表更新统计信息 EXEC sp_updatestats
-- 5 查看数据库中所有index的统计时间 SELECT [Table Name] = o.name, [Index Name] = i.name, [Statistics Date] = STATS_DATE(i.id, i.indid) FROM sysobjects o, sysindexes i WHERE o.id = i.id ORDER BY [Statistics Date] DESC GO
--6 为没有最新统计信息的表生成修改统计信息SQL SELECT 'UPDATE STATISTICS ' + o.name + ' ' + i.name FROM sysobjects o, sysindexes i WHERE o.id = i.id and o.type = 'U' and STATS_DATE(i.id, i.indid) is null
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2008-10-28,如有侵权请联系 cloudcommunity@tencent 删除统计数据库autostatistics索引有关statistics
-- 1 查看/修改 数据库auto create statistics选项值 sp_dboption 'CommunityServer', 'auto create statistics' sp_dboption 'CommunityServer', 'auto create statistics', 'TRUE'
-- 2 查看表中索引index或统计collection的分布统计信息 DBCC SHOW_STATISTICS ('cs_Sections', '_WA_Sys_ParentID_7D0E9093')
-- 3 为某表更新统计信息 -- 本示例仅更新表 authors 的索引 au_id_ind 的分发信息 UPDATE STATISTICS authors au_id_ind
-- 4为数据库中所有表更新统计信息 EXEC sp_updatestats
-- 5 查看数据库中所有index的统计时间 SELECT [Table Name] = o.name, [Index Name] = i.name, [Statistics Date] = STATS_DATE(i.id, i.indid) FROM sysobjects o, sysindexes i WHERE o.id = i.id ORDER BY [Statistics Date] DESC GO
--6 为没有最新统计信息的表生成修改统计信息SQL SELECT 'UPDATE STATISTICS ' + o.name + ' ' + i.name FROM sysobjects o, sysindexes i WHERE o.id = i.id and o.type = 'U' and STATS_DATE(i.id, i.indid) is null
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2008-10-28,如有侵权请联系 cloudcommunity@tencent 删除统计数据库autostatistics索引本文标签: 有关statistics
版权声明:本文标题:有关statistics 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1747968997a2235246.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论