Performance Tuning - 3 lakhs Record - Need help - Urgent
501777Oct 26 2006 — edited Oct 26 2006I am using a dynamic pl/sql to frame the query for 29 times.
Every query will fetch 3 lakhs record and for filtering without duplication it takes 35 seconds (to do the process). So totally 29 loop * 35 minutes=around 17 minutes.
Totally the entire process takes 15 minutes.
How could i reduce the time and improve the performance.
Since to avoid duplication group by with min function is used.
Is any other method available to handle this scenario.
The query is fetching value from the view test_v and has the value like this (i.e) with duplication.
Name Null? Type
----------------------------------------- -------- ----------------------------
H_ID VARCHAR2(20)
CD VARCHAR2(2)
NODE_ID VARCHAR2(12)
PRNT_NODE_ID VARCHAR2(12)
H_ID CN NODE_ID PRNT_NODE
-------------------- -- ------------ ------------
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH XE S579901 S579999
CSH GB S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH GB S579901 S579999
CSH US S579901 S579999
CSH HK S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH US S579901 S579999
CSH SG S579901 S579999
CSH GB S579901 S579999
CSH GB S579901 S579999
CSH XL S579901 S579999
The pl/sql code is
/* Formatted on 2006/10/25 17:47 (Formatter Plus v4.8.0) */
DECLARE
temp VARCHAR2 (4000);
BEGIN
DBMS_OUTPUT.put_line ('First Set ...1');
FOR i IN 21 .. 29
LOOP
DBMS_OUTPUT.put_line ('Data set ....->' || TO_CHAR (i));
temp :='insert into test
select a.id,
a.cd,
a.data'|| TO_CHAR (i + 1) || ' as node_id,
min(a.data'|| TO_CHAR (i)|| ') as prnt_node_id
From test_v a
Group by a.id,a.cd,a.data'|| TO_CHAR (i + 1);
EXECUTE IMMEDIATE temp;
DBMS_OUTPUT.put_line ('Success for data set ...->' || TO_CHAR (i));
COMMIT;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('error' || SQLCODE () || '=' || SQLERRM ());
END;
/
How to improve the performance.
Please suggest methods
thanks in advance.