短信客户表(Client),500万条数据,并且每月以100万条的速度快速增长中
ID   Mobile(客户手机) re(备注)   employeeID(录入人) CreateTime(录入时间)      ClinetSort(分类)
1    13813813813        100万客户       80273                   2010-1-6                 其他分类
2    13813813813        200万客户       80373                   2010-1-6                 我的分类
3    13713713913        100万           80374                   2010-1-6                 客户
Client(客户表)里存在大量相同的客户号码,只不过录入人(employeeID)不一样,现在数据量大了后,查询速度变的很慢,半天不响应,有时甚至超时,求个好的解决方案,谢谢,数据库是2000的

解决方案 »

  1.   

    select ID,ClientSort,Mobile,EmployeeID,re from Client where Status=0 and state=0 AND Status = state and clientsort<>'黑名单' and clientsort<>'我已成交客户' and EmployeeID=@employeeid 
      

  2.   

    可以看下程序中经常用到的where 字段 
    比如说select * from Client where Mobile = '13813813813' and ClinetSort='客户'
    这句话调用的最多可以创建索引
    CREATE NONCLUSTERED INDEX [Idx_P_Index_Mobile_ClinetSort] ON [dbo].[Client] 
    (
    [Mobile] ASC,
    [ClinetSort] ASC
    )另外: 系统中查询此表的语句在表名后面加上(nolock)
    select * from Client(nolock) where Mobile = '13813813813' and ClinetSort='客户'
      

  3.   


    需要知道status state empoyeeid数据的分布情况。可以先尝试EmployeeID上加索引试试.