请教一个存储过程的优化,一运行这个数据库就占用98%,我想是instr占用内存太多的原因,不知道怎么优化
create or replace procedure TYPE_UPDATESTATE_temp
(
TYPE_TABLE_NAME VARCHAR, --表名
TYPE_ID varchar, --id连起的字符串,例(12,13,14)
Type_State number --状态值
)
is
begin
if TYPE_TABLE_NAME = 'article' then
update t_article set a_state=Type_State where instr(','||TYPE_ID||',',','||a_id||',')>0 ;
update t_article_index set ai_state=Type_State where ai_type=0 and instr(','||TYPE_ID||',',','||ai_src||',')>0;
if Type_state =5 then
update t_topic set t_list=t_list-1 where t_id in (select a_topic from t_article where a_topic>0 and instr(','||TYPE_ID||',',','||a_id||',')>0 ;
--update t_user set u_article=u_article-1 where u_id in (select a_user from a_article where a_topic>0 and instr(','||TYPE_ID||',',','||a_id||',')>0 ;
end if;
end if;
end TYPE_UPDATESTATE_temp;
数据量t_article现在30W以上,t_article_index40W以上
a_topic现在10W,t_user现在100W以上