最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

有关statistics

网站源码admin5浏览0评论

有关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索引

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论