求大神帮我优化这个sql语句
select distinct userid from userlog where userid not in(select distinct userid from #user)
and accesstime >='2013-04-27' and accesstime<'2013-04-28';
怎么修改? 现在效率太低
------解决方案--------------------select distinct userid
from userlog t
where
not exists(select userid from #user t1 where t.userid=t1.userid)
and accesstime >='2013-04-27' and accesstime<'2013-04-28';
userlog以及#user表中userid设置索引
userlog中创建accesstime索引
http://www.cnblogs.com/worfdream/articles/3040204.html