c+oracle+bulk,【讨论】bulk collect insert 效率慢

批量插入数据,2个半小时才插入了100w数据。

大伙帮忙分析一下,到底什么原因???

cursor c_earn_prem12_adj (c_cal_month  dxpg_prem_mid_table.j_date%type)is

select /*+parallel(a,10) full(a)*/sys_guid() id_ep_claim_ibnr_fr,

deptflag,

role_type,

busi_src_type,

plan_code,

'*' manage_fee_rate,

c_cal_month val_month,

0 tot_gross,

0 tot_net_prem,

0 tot_gross_accu ,

0 tot_net_accu ,

0 ep_gross_adj,

0 ep_net_adj ,

0 ep_gross_org,

0 ep_net_org,

sum(earn_gross_prem) ep_gross_12,

sum(earn_net_prem) ep_net_12,

0 ep_gross_accu,

0 ep_net_accu,

0 paid_amt_adj,

0 paid_amt_org,

0 paid_amt_12,

0 paid_amt_accu,

0 acci_amt_adj,

0 acci_amt_org,

0 acci_amt_12,

0 acci_amt_accu,

0 ibnr_bf,

0 ibnr_cl,

0 unearned_gross_adj,

0 unearned_net_adj,

0 unearned_gross_org,

0 unearned_net_org,

category_type,

polno,

undwrt_date,

0 exp_paid_amt_adj,

0 exp_paid_amt_org,

0 exp_paid_amt_12,

0 exp_paid_amt_accu,

'gresvcde' created_by,

sysdate created_date,

'gresvcde' updated_by,

sysdate updated_date,

0 ibnr ,

0 ir,

0 claim_salary,

0 claim_expense_ibnr,

0 ibnr_margin,

0 claim_salary_accu,

0 claim_salary_12

from dxpg_prem_mid_table a

where earn_prem_month_adj <= c_cal_month

and earn_prem_month_adj >  c_cal_month - 100

group by deptflag,

polno,

plan_code,

role_type,

busi_src_type,

category_type,

undwrt_date ;

type v_earn_prem12_adj is table of c_earn_prem12_adj%rowtype index by binary_integer;

d_earn_prem12_adj  v_earn_prem12_adj;

open c_earn_prem12_adj(p_cal_month);

loop

fetch c_earn_prem12_adj bulk collect

into d_earn_prem12_adj limit 30000; --分批次提交,每次 30000

forall ind in d_earn_prem12_adj.first .. d_earn_prem12_adj.count

insert into ep_claim_ibnr_fr values d_earn_prem12_adj(ind);

commit;

exit when c_earn_prem12_adj%notfound;

end loop;

close c_earn_prem12_adj;

commit;

你可能感兴趣的:(c+oracle+bulk)