|
蓝森林 http://www.lslnet.com 2006年7月18日 11:08
请教:存储过程
下面是我写的存储过程,运行起来特别慢,怎么也出不来,是数据库原因还是我写的不准确?
department,subject,currency_code 是ledger_info主键,19000条记录
bank_org_id,product_id,currency_code是主键,140000条记录
update ledger_info set (balance,sum)
= (select a.curr_balance,ledger_info.sum+a.curr_balance
from pre_date_glender a
where cast(a.bank_org_id as varchar(9)) =
ledger_info.department
and a.product_id = ledger_info.subject
and a.currency_code = ledger_info.currency_code); |
请教:存储过程
你每次都要将表ledger_info 的记录全部修改吗?
最好不要使用cast(。。。)的函数。
是联合主健吗? |
请教:存储过程
是联合主键,每条记录都要修改。有什么好的办法?
用cast函数会很慢? |
请教:存储过程
用cast函数就不能使用主键(索引),当然很慢
如果必须使用cast函数,唯一的办法是修改表结构定义的数据类型 |
请教:存储过程
我觉的你可以改成用游标循环修改试试,看速度是否可以 |
| |