zoukankan      html  css  js  c++  java
  • SQL SERVER 索引维护

    -- 全数据库索引重建

    DECLARE @name varchar(100)
    DECLARE authors_cursor CURSOR FOR Select [name] from sysobjects where xtype='u' order by id
    OPEN authors_cursor
    FETCH NEXT FROM authors_cursor INTO @name
    WHILE @@FETCH_STATUS = 0
    BEGIN
     DBCC DBREINDEX (@name, '', 90)
    FETCH NEXT FROM authors_cursor INTO @name
    END
    deallocate authors_cursor

    -- 单表数据库维护

    -- 单表重建索引

    dbcc dbreindex('表名',索引名称,100)

    -- 查看表索引密集度

    declare @table_id int
    set @table_id=object_id('表名称')
    dbcc showcontig(@table_id)

    --参数说明,第三个参数表示填充因子

    低更改的表(读写比率为100:1):100%的填充因子
    高更改的表(写超过读):50-70%的填充因子
    读写各一半的:80-90%的填充因子

    -- 数据库检查碎片

    DBCC ShowContig
    DBCC ShowContig(表名)

  • 相关阅读:
    魔法跳舞链 51Nod
    反射
    JDBC---后端服务器与数据库交互的桥梁
    多线程
    IO流
    继承与重写
    java.util包
    多态
    Java.lang包
    异常
  • 原文地址:https://www.cnblogs.com/chengeng/p/6422688.html
Copyright © 2011-2022 走看看