sql优化新手,求指教公司人让我自己查 求引导informix 索引方面吧,谢谢
select count(distinct m.id) as num,
s.deptfax,
s.remark
from commonfault_main m,
commonfault_link l,
taw_system_deptrefrole1 d,
taw_system_dept s
where m.id = l.mainid
and m.deleted = 0
and l.operatetype = 0
and l.toorgroleid = d.subroleid
and d.deptid = s.deptid
and m.sendtime >'${begin}'
and m.sendtime < '${end}'
group by s.deptfax,s.remark
order by s.deptfax,s.remark
这个sql 改怎么优化,现在我得知看下这个几个表索引全不全,然后看下这个几个表的索引层数 是这个sql
select b.tabname,a.levels
from sysindexes a, systables b
where b.tabid=a.tabid
and b.tabname=''
得到的3322,据说全是0比较好。。。我数据库很烂的。。现在我不知道怎么办了 重建索引?忘说了这几表索引是
main表的是sheetid,mainalarmnum,sendtime
link表的是aiid,mainid,operatetime
taw_system_deptrefrole1表没有
taw_system_dept的是deptid,