Web程序在运行过程中发现速度很慢,一个Select要36分钟,所以,
set showplan_text on
go
SELECT userid,ope_date,ope_data,seq_num,ope_count,ope_appl_no,evt_id
FROM lamsec_opelog
WHERE (cre_date <= '20050921030213') AND (cre_date >= '20050920161713') AND (userid = 758) AND (evt_id > 0)
ORDER BY cuserid, ope_date,cseq_num
这个是分析执行过程的。
下面的是刷新统计状态的
update statistics lamsec_opelog
with fullscan
这个是强行按照某个Index来走的
SELECT userid,ope_date,ope_data,seq_num,ope_count,ope_appl_no,evt_id
FROM lamsec_opelog(index(lamsec_opelog_index_cre_date_id))
WHERE (cre_date <= '20050921030213') AND (cre_date >= '20050920161713') AND (userid = 107) AND (evt_id > 0)
ORDER BY cuserid, ope_date,cseq_num
set showplan_text on
go
SELECT userid,ope_date,ope_data,seq_num,ope_count,ope_appl_no,evt_id
FROM lamsec_opelog
WHERE (cre_date <= '20050921030213') AND (cre_date >= '20050920161713') AND (userid = 758) AND (evt_id > 0)
ORDER BY cuserid, ope_date,cseq_num
这个是分析执行过程的。
下面的是刷新统计状态的
update statistics lamsec_opelog
with fullscan
这个是强行按照某个Index来走的
SELECT userid,ope_date,ope_data,seq_num,ope_count,ope_appl_no,evt_id
FROM lamsec_opelog(index(lamsec_opelog_index_cre_date_id))
WHERE (cre_date <= '20050921030213') AND (cre_date >= '20050920161713') AND (userid = 107) AND (evt_id > 0)
ORDER BY cuserid, ope_date,cseq_num