1,看一下有没有建分区表
2,看一下索引情况
3,尝试把查询写成这样:WHERE Tlog_date>='2009-1-8' AND Tlog_date<DATEADD(dd,1,'2009-1-8') AND  ..另外,in可以考滤改为内连接试一下。

解决方案 »

  1.   

    不如直接改为:
    year(Tlog_date) = 2009 and month(Tlog_date) = 1 and day(Tlog_date) = 8
    或者
    convert(varchar(10),Tlog_date,120) = '2009-01-08'
      

  2.   

    SELECT m.* FROM Tlog m,log_dirclassify n , TdirClassfiy_id o 
    where convert(varchar(10),m.Tlog_date,120) = '2009-01-08' and o.Tblog_id=4312 and 
          m.Tlog_id = n.Tlog_id and n.TdirClassfiy_id = o.TdirClassfiy_idSELECT m.* FROM Tlog m,log_dirclassify n , TdirClassfiy_id o 
    where year(m.Tlog_date) = 2009 and month(m.Tlog_date) = 1 and day(m.Tlog_date) = 8 and o.Tblog_id=4312 and 
          m.Tlog_id = n.Tlog_id and n.TdirClassfiy_id = o.TdirClassfiy_id
      

  3.   

    2008-1-8
    2008-1-9
    从客户端组装啊,
    老在where后用函数会很不吉利的,
    而且SQLServer好像是没有函数索引的
      

  4.   


    加了行锁,造成了堵塞吧
    /*
    测试数据
    create table t
    (id int,val nvarchar(20))
    go
    create clustered index aa on t(id)
    go
    declare @index int
    set @index = 1
    while (@index <= 100)
    begin
    insert t(id) select @index
    set @index = @index + 1
    end
    */
    查询1(默认隔离级别)
    begin tran
    update t set val = 'aaa' where id between 20 and 30查询2(默认隔离级别)
    select * from t where id = 19 --可以查询
    select * from t where id = 20 --被堵塞通过sys.dm_tran_locks可以看到加了11个行X,page是IX另外写成下面的比较好
    Tlog_date >= '2009-1-8' and Tlog_date < '2009-1-9'