insert time is drastically reduced [message #664010] |
Mon, 03 July 2017 06:28 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/6cfdbdc57ab6eee69f4fb81d1a115c15?s=64&d=mm&r=g) |
fabi88
Messages: 112 Registered: November 2011
|
Senior Member |
|
|
Hi,
there is a procedure for inserting data to a table, table ddl and procedure are as follows:
CREATE TABLE PT_PRO
(
ID NUMBER GENERATED ALWAYS AS IDENTITY INCREMENT BY 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 CACHE 20 ORDER NOT NULL
, DATE_ID NUMBER NOT NULL
, GROUP_ID NUMBER
, TYPE_ID NUMBER
, CODE NUMBER
}
(There is also an index on each column.)
declare
type t_date_id is table of pt_pro.date_id%type index by pls_integer;
type t_group_id is table of pt_pro.group_id%type index by pls_integer;
type t_type_id is table of pt_pro.type_id%type index by pls_integer;
type t_code is table of pt_pro.code%type index by pls_integer;
p_ date_id t_date_id;
p_ group_id t_group_id;
p_ type_id t_type_id;
p_code t_code; "
begin
p_ date_id := :date_id;
p_ group_id := : group_id ;
p_ type_id := : type_id;
p_code := :code;
forall i in p_date.first..p_date_id.last
insert into pt_pro (date_id,group_id,type _id,code)
values (p_date_id(i), p_group_id(i) , p_type_id(i), p_code(i));
Previously, our inserting process was around 2 million record in 40 second,But now 7,000 records are inserting in 30 second(In some cases even more).
2 Images are attached, attached images show execution plan and consumed times.
Cloud anyone help me for resolving this issue?
-
Attachment: 2.png
(Size: 27.98KB, Downloaded 2006 times)
[Updated on: Mon, 03 July 2017 06:31] Report message to a moderator
|
|
|
|
|
|
Re: insert time is drastically reduced [message #664063 is a reply to message #664010] |
Tue, 04 July 2017 07:20 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/6cfdbdc57ab6eee69f4fb81d1a115c15?s=64&d=mm&r=g) |
fabi88
Messages: 112 Registered: November 2011
|
Senior Member |
|
|
Formatted SQL Trace output using TKprof is as follow:
SQL ID: 8vfg94vf8m7m9 Plan Hash: 523367902
INSERT INTO PT_PRO(DATE_ID,GROUP_ID,TYPE_ID,
CODE)
VALUES
(:B1 , :B2 , :B3 , :B4 )
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.65 12.92 7426 857 165865 8022
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 1 0.65 12.92 7426 857 165865 8022
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 103 (D_USER) (recursive depth: 1)
Rows Execution Plan
------- ---------------------------------------------------
0 INSERT STATEMENT MODE: ALL_ROWS
0 LOAD TABLE CONVENTIONAL OF 'PT_PRO'
0 SEQUENCE OF 'ISEQ$$_108127' (SEQUENCE)
[Updated on: Tue, 04 July 2017 07:21] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: insert time is drastically reduced [message #664082 is a reply to message #664077] |
Tue, 04 July 2017 08:13 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Roachcoach
Messages: 1576 Registered: May 2010 Location: UK
|
Senior Member |
|
|
It's not about being perfect, those values leave you vulnerable to contention and contention is often a transient, "sometimes there" event. Thus we strive to remove points of contention in order to scale effectively/maintain a stable performance profile.
If there is still a problem after that we can look again.
[Updated on: Tue, 04 July 2017 08:14] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|