上半年还好好的,什么都没动,从七月份开始,出现怪事,从一张表中查询一条记录,要等半个小时才能执行完毕,中间虚拟内存被耗光。select * from tb where id = '100'重建索引之后,好了半个小时,之后又开始变慢,最后又慢成乌龟了。

解决方案 »

  1.   

    查询一条数据,等半个小时,执行select  count(*) from tb,15分钟才出结果。
      

  2.   

    select * from tb where id = 100
    去掉100的单引号试试。
    另外重新创建一个表试试。
    create table tb(id int identity,insert_date datetime)
    declare @i int
    set @i = 100000
    while @i > 0
    begin
          insert into tb(insert_date) valuses(getdate());
          set @i = @i - 1;
    endselect * form tb where id = i00
      

  3.   

    执行select count(1) from tb 试试慢不慢。有多少行记录》
    楼主的问题有点不可思议,应该就0秒搞定的事情。
      

  4.   

    提供以下思路:
    1.Server配置,考虑升级
    2.DB版本
    3.建立Index,要定时的重建索引(操作次数多,会有索引碎片)
    4.历史数据备份http://www.cnblogs.com/changbluesky/archive/2010/07/12/1771210.html
      

  5.   

    一条记录怎么会有那么大的内容?23W*1M = 224G