Need help on performance of this sql
Hi,
I have 2million records in my table, now i need to add one new column and have to update records into this column using sequence.
Ex. update table_name
set new_column = sequ_name.nextval
where col1 = batch_id;
My question is, if i update like this for the batch_id(same id for 1.5million records), will it affect the performace. or is it any other best way to achieve this...
kindly help..
Regards,
Nag
We had a similar project and in test it took several hours to run. When I upped the sequence cache to 5000 it completed in less than a 10th of the time. Worth trialling different values for the sequence cache, as I suspect there are diminishing returns as it gets larger (setting the cache size to 1.5 million would probably not be a good idea).
Similar Messages
-
my Creative Cloud subscription has expired, and I assigned the monthly payment, but I can not open any progam creative cloud, I need help how to solve this problem
Carlos-
Start by signing out and back in to see if it will see the subscription:
How to sign in and sign out of creative cloud (activate/deactivate)
If the apps are installed fine and close after launch see this link:
CC applications close immediately after launch
If the problem is something different, please let us know the error you see or what is happening on the screen so we can advise you on a solution
Pattie -
Hello I Download Adobe Photoshop CC 2014 Last Night
i INSTALLED it But it Crashes in 30-40 Sec After i Launch the Product Without Any Error Message
I Need Help Can You Resolve This ProblemLotfi are you receiving any error messages during the installation? I would recommend reviewing your installation logs for errors. Please see Troubleshoot install issues with log files | CC - http://helpx.adobe.com/creative-cloud/kb/troubleshoot-install-logs-cc.html for information on how to locate and interpret your installation log files. You are welcome to post any specific errors you discover to this discussion.
-
Need help in Performance tuning for function...
Hi all,
I am using the below algorithm for calculating the Luhn Alogorithm to calculate the 15th luhn digit for an IMEI (Phone Sim Card).
But the below function is taking about 6 min for 5 million records. I had 170 million records in a table want to calculate the luhn digit for all of them which might take up to 4-5 hours.Please help me performance tuning (better way or better logic for luhn calculation) to the below function.
A wikipedia link is provided for the luhn algorithm below
Create or Replace FUNCTION AddLuhnToIMEI (LuhnPrimitive VARCHAR2)
RETURN VARCHAR2
AS
Index_no NUMBER (2) := LENGTH (LuhnPrimitive);
Multiplier NUMBER (1) := 2;
Total_Sum NUMBER (4) := 0;
Plus NUMBER (2);
ReturnLuhn VARCHAR2 (25);
BEGIN
WHILE Index_no >= 1
LOOP
Plus := Multiplier * (TO_NUMBER (SUBSTR (LuhnPrimitive, Index_no, 1)));
Multiplier := (3 - Multiplier);
Total_Sum := Total_Sum + TO_NUMBER (TRUNC ( (Plus / 10))) + MOD (Plus, 10);
Index_no := Index_no - 1;
END LOOP;
ReturnLuhn := LuhnPrimitive || CASE
WHEN MOD (Total_Sum, 10) = 0 THEN '0'
ELSE TO_CHAR (10 - MOD (Total_Sum, 10))
END;
RETURN ReturnLuhn;
EXCEPTION
WHEN OTHERS
THEN
RETURN (LuhnPrimitive);
END AddLuhnToIMEI;
http://en.wikipedia.org/wiki/Luhn_algorithmAny sort of help is much appreciated....
Thanks
RedeThere is a not needed to_number function in it. TRUNC will already return a number.
Also the MOD function can be avoided at some steps. Since multiplying by 2 will never be higher then 18 you can speed up the calculation with this.
create or replace
FUNCTION AddLuhnToIMEI_fast (LuhnPrimitive VARCHAR2)
RETURN VARCHAR2
AS
Index_no pls_Integer;
Multiplier pls_Integer := 2;
Total_Sum pls_Integer := 0;
Plus pls_Integer;
rest pls_integer;
ReturnLuhn VARCHAR2 (25);
BEGIN
for Index_no in reverse 1..LENGTH (LuhnPrimitive) LOOP
Plus := Multiplier * TO_NUMBER (SUBSTR (LuhnPrimitive, Index_no, 1));
Multiplier := 3 - Multiplier;
if Plus < 10 then
Total_Sum := Total_Sum + Plus ;
else
Total_Sum := Total_Sum + Plus - 9;
end if;
END LOOP;
rest := MOD (Total_Sum, 10);
ReturnLuhn := LuhnPrimitive || CASE WHEN rest = 0 THEN '0' ELSE TO_CHAR (10 - rest) END;
RETURN ReturnLuhn;
END AddLuhnToIMEI_fast;
/My tests gave an improvement for about 40%.
The next step to try could be to use native complilation on this function. This can give an additional big boost.
Edited by: Sven W. on Mar 9, 2011 8:11 PM -
Need help on syntax of PL/SQL Table type
Hi Everyone
I have the following Procedure
DECLARE
TYPE ln_empno IS TABLE OF NUMBER;
ln_empno1 ln_empno;
dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT (dml_errors, -24381);
ERRORS NUMBER;
BEGIN
UPDATE emp
SET empno = empno
RETURN empno
BULK COLLECT INTO ln_empno1;
FORALL idx IN 1 .. ln_empno1.COUNT SAVE EXCEPTIONS
INSERT INTO t1
VALUES (ln_empno1 (idx));
EXCEPTION
WHEN dml_errors
THEN
ERRORS := SQL%BULK_EXCEPTIONS.COUNT;
FOR i IN 1 .. ERRORS
LOOP
DBMS_OUTPUT.put_line ( 'Error '
|| i
|| ' occurred during '
|| 'iteration '
|| SQL%BULK_EXCEPTIONS (i).ERROR_INDEX
DBMS_OUTPUT.put_line ( 'Oracle error is '
|| SQLERRM (-SQL%BULK_EXCEPTIONS (i).ERROR_CODE
END LOOP;
END;
This will collect the single column, I am not able to get the syntax to create a record containg empno and ename and bulk collect into a collection type.
Can anyone help me to execute this procedure for ln_empno as a record of empno and ename.
Thanks in Advance
-AhmedAlso,
If you want it as an update then why not just alter as per my example... e.g.
SQL> ed
Wrote file afiedt.buf
1 DECLARE
2 TYPE lt_emp_rec IS RECORD (empno NUMBER, deptno NUMBER);
3 TYPE lt_emp IS TABLE OF lt_emp_rec INDEX BY PLS_INTEGER;
4 lr_emp lt_emp;
5 BEGIN
6 UPDATE emp
7 SET deptno = deptno+10
8 RETURNING empno, deptno
9 BULK COLLECT INTO lr_emp;
10 FOR idx IN 1 .. lr_emp.COUNT
11 LOOP
12 DBMS_OUTPUT.PUT_LINE('EmpNo: '||to_char(lr_emp(idx).empno)||' ::: DeptNo: '||to_char(lr_emp(idx).deptno));
13 END LOOP;
14* END;
SQL> /
EmpNo: 7369 ::: DeptNo: 30
EmpNo: 7499 ::: DeptNo: 40
EmpNo: 7521 ::: DeptNo: 40
EmpNo: 7566 ::: DeptNo: 30
EmpNo: 7654 ::: DeptNo: 40
EmpNo: 7698 ::: DeptNo: 40
EmpNo: 7782 ::: DeptNo: 20
EmpNo: 7788 ::: DeptNo: 30
EmpNo: 7839 ::: DeptNo: 20
EmpNo: 7844 ::: DeptNo: 40
EmpNo: 7876 ::: DeptNo: 30
EmpNo: 7900 ::: DeptNo: 40
EmpNo: 7902 ::: DeptNo: 30
EmpNo: 7934 ::: DeptNo: 20
PL/SQL procedure successfully completed.
SQL>Was that so hard? -
Need help with an XML-based SQL query
Hello, everyone:
I get 'no rows selected' from the following queries:
SELECT extractValue((p.entity_types_xml), '/entities/test[a=fagioli]')
FROM entity_types p
WHERE
existsNode(p.entity_types_xml,
'/entities/test/text()') = 1;
SELECT extractValue((p.entity_types_xml), '/entities/test/text()')
FROM entity_types p
WHERE
existsNode(p.entity_types_xml, '/entities/test/text()') = 1;
SELECT
extractValue(p.entity_types_xml,'/entities/ARFinance-elem/entity-type')
FROM entity_types p
WHERE
existsNode(p.entity_types_xml,'/entities/ARFinance-elem/ARFinanceTBD/text()') = 1;
where the entity_types table looks like this:
SQL> desc entity_Types;
Name Null? Type
ENTITY_TYPES_ID NOT NULL VARCHAR2(36)
ENTITY_TYPES_XML NOT NULL XMLTYPE
CLIENT_ID VARCHAR2(30)
and the XML fragment looks like this:
+++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>
<entities
xmlns="http://www.thirdpillar.com/xml/namespace/aom/entity"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.thirdpillar.com/xml/namespace/aom/entity ../generated/denormalized-schema.0.xsd">
<test a="fagioli">pasta</test>
<ARFinance-elem>
<uid b="pasta">123</uid>
<entity-type><![CDATA[ARFinance]]></entity-type>
<ARFinanceTBD>tobedetermined</ARFinanceTBD>
</ARFinance-elem>
++++++++++++++++++++++++++++++++++++++++++++
As you can see, there is data in /entities/test[@a] as well as /entities/test/text(),
so why aren't any of the queries returning the preceding XML fragment? Suggestions welcome and appreciated....
Regards,
Oswald
ps: I'm sure I've overlooked something simple.Oswald,
I think you need to add the namespace
select extractValue(.....','xmlns:xsi="http://www.thirdpillar.com/xml/namespace/aom/entity"')
from entity_types p -
Need Help with setting up this Filter
Hi,
I need help making a filter sound like the one used in this youtube song.
I tried setting it up but I've had no success; even though I know for a fact that this filter was made in Logic Pro 9 according to the maker of this song.
I think there might be a bit of 'Fuzz-Wah' in there too but I've never really used that effect so any tips on that would be great, too.
Link: http://www.youtube.com/watch?v=tf017M8SZZE&feature=plcp
Any help with this would be widely appreciated.
Thank you :-)It sounds like a simple hi Q filter sweep to me but getting close to the original synth sound that it is being used on is the challenge. It might well be that it is the filter on the synth itself is what is being swept. Either way, turn up the filter resonance on a band pass filter and sweep it with the lfo or adsr to modulate the filter cutoff if its the synth filter, or automate the filter frequency sweep if you use the channel filter.
-
I cannot remember my security question answers to authorize my new computer. Need help to establish new ones or find the answers to the originals.
Thanks for any help on this.Click here for information. If you can't get the answers emailed to you for some reason, contact the iTunes Store staff via the link in that article.
(76299) -
Need help in writing a tricky sql/PL/Sql Procedure
Hi,
I have a Branch table with just two fields in it node1 and Node2, The table looks like this
node1 | node2
-------|---------
1 | 2
3 | 2
3 | 4
4 | 5
1 | 5
1 | 6
5 | 6
in the above data if you draw lines between node_1 and node_2 you will see that there are 3 different paths to get from 1 to 5, as follows
/--------6-------\
1----------------------5
\2------3-------4/
Now I need to Find all the nodes between 1 and 5 or all the possible paths from node 1 to node 5 in this case I have 3 possible paths they are as follows
1-2-3-4-5
1-3-5
1-5
Now I know if this data was stored in a hierarchical manner I can get the results i want by using CONNECT BY and SYS_CONNECT_BY_PATH.
Is there a way to transform this data into a hierarchcal manner so that I can use the CONNECT BY or can somebody give me an Idea as to how to write a PL/SQL procedure to get the result I want.
Any help will be greatly appreciatedHi!
1.Create another table Branch1 to hold 'transformed data'.
2.Use the following procedure to insert data into branch1 table.
declare
cursor n is select * from branch;
begin
for nrec in n loop
if nrec.node1 = 5 then
insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
elsif nrec.node2= 5 then
insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
else
if nrec.node2> 5 then
insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
elsif nrec.node1> 5 then
insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
elsif (nrec.node1 < nrec.node2 ) then
insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
else
insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
end if;
end if;
end loop;
commit;
end;
3.Then execute the following connect by query:
SQL> select lpad(' ',level*2,' ')||node1 from branch1
2 start with node1=1
3 connect by prior node2=node1;
Hope this is satisfactory.
Thanks! -
Need help writing Performance Management Report
Hi Experts
I need some help retrieving specific Performance Management data for a report.
I have the employee pernr.
1. From this I need to determine which teams the employee belonged to for the period 1 Oct - 31 Sept.
2. What was the total performance score for the TEAM for that same period.
Can someone please help me out. The table data seems to be quite complex.
Thannks in advance
Anton Kruse
Moderator Message: Specs-dumping is not allowed. Please get back if you have a specific question
Edited by: kishan P on Mar 7, 2012 5:10 PMHi Arnold,
I think the solution provided by Vadim is the only way and it's working.
Shrikant -
hallow
i doing this select and it take more then 10 minutes and i don't now way because
object_key have just 60 entries ?
how i can slve this problem?
Regards
SELECT * FROM covp APPENDING TABLE *covp
FOR ALL ENTRIES IN object_key
WHERE kokrs EQ '1000'
AND objnr EQ object_key-objnr
AND budat IN so_budat
AND stflg EQ space .Ways of Performance Tuning
1. Selection Criteria
2. Select Statements
Select Queries
SQL Interface
Aggregate Functions
For all Entries
Select Over more than one internal table
Selection Criteria
1. Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement.
2. Select with selection list.
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
SELECT CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
WHERE SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
Select Statements Select Queries
1. Avoid nested selects
SELECT * FROM EKKO INTO EKKO_WA.
SELECT * FROM EKAN INTO EKAN_WA
WHERE EBELN = EKKO_WA-EBELN.
ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
FROM EKKO AS P INNER JOIN EKAN AS F
ON PEBELN = FEBELN.
Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
2. Select all the records in a single shot using into table clause of select statement rather than to use Append statements.
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
SELECT CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
WHERE SBOOK_WA-CARRID = 'LH' AND
SBOOK_WA-CONNID = '0400'.
3. When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.
To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields. In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
4. For testing existence, use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit.
SELECT * FROM SBOOK INTO SBOOK_WA
UP TO 1 ROWS
WHERE CARRID = 'LH'.
ENDSELECT.
The above code is more optimized as compared to the code mentioned below for testing existence of a record.
SELECT * FROM SBOOK INTO SBOOK_WA
WHERE CARRID = 'LH'.
EXIT.
ENDSELECT.
5. Use Select Single if all primary key fields are supplied in the Where condition .
If all primary key fields are supplied in the Where conditions you can even use Select Single.
Select Single requires one communication with the database system, whereas Select-Endselect needs two.
Select Statements SQL Interface
1. Use column updates instead of single-row updates
to update your database tables.
SELECT * FROM SFLIGHT INTO SFLIGHT_WA.
SFLIGHT_WA-SEATSOCC =
SFLIGHT_WA-SEATSOCC - 1.
UPDATE SFLIGHT FROM SFLIGHT_WA.
ENDSELECT.
The above mentioned code can be more optimized by using the following code
UPDATE SFLIGHT
SET SEATSOCC = SEATSOCC - 1.
2. For all frequently used Select statements, try to use an index.
SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
WHERE CARRID = 'LH'
AND CONNID = '0400'.
ENDSELECT.
The above mentioned code can be more optimized by using the following code
SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
WHERE MANDT IN ( SELECT MANDT FROM T000 )
AND CARRID = 'LH'
AND CONNID = '0400'.
ENDSELECT.
3. Using buffered tables improves the performance considerably.
Bypassing the buffer increases the network considerably
SELECT SINGLE * FROM T100 INTO T100_WA
BYPASSING BUFFER
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
The above mentioned code can be more optimized by using the following code
SELECT SINGLE * FROM T100 INTO T100_WA
WHERE SPRSL = 'D'
AND ARBGB = '00'
AND MSGNR = '999'.
Select Statements Aggregate Functions
If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates yourself.
Some of the Aggregate functions allowed in SAP are MAX, MIN, AVG, SUM, COUNT, COUNT( * )
Consider the following extract.
Maxno = 0.
Select * from zflight where airln = LF and cntry = IN.
Check zflight-fligh > maxno.
Maxno = zflight-fligh.
Endselect.
The above mentioned code can be much more optimized by using the following code.
Select max( fligh ) from zflight into maxno where airln = LF and cntry = IN.
Select Statements For All Entries
The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
The plus
Large amount of data
Mixing processing and reading of data
Fast internal reprocessing of data
Fast
The Minus
Difficult to program/understand
Memory could be critical (use FREE or PACKAGE size)
Points to be must considered FOR ALL ENTRIES
Check that data is present in the driver table
Sorting the driver table
Removing duplicates from the driver table
Consider the following piece of extract
Loop at int_cntry.
Select single * from zfligh into int_fligh
where cntry = int_cntry-cntry.
Append int_fligh.
Endloop.
The above mentioned can be more optimized by using the following code.
Sort int_cntry by cntry.
Delete adjacent duplicates from int_cntry.
If NOT int_cntry[] is INITIAL.
Select * from zfligh appending table int_fligh
For all entries in int_cntry
Where cntry = int_cntry-cntry.
Endif.
Select Statements Select Over more than one Internal table
1. Its better to use a views instead of nested Select statements.
SELECT * FROM DD01L INTO DD01L_WA
WHERE DOMNAME LIKE 'CHAR%'
AND AS4LOCAL = 'A'.
SELECT SINGLE * FROM DD01T INTO DD01T_WA
WHERE DOMNAME = DD01L_WA-DOMNAME
AND AS4LOCAL = 'A'
AND AS4VERS = DD01L_WA-AS4VERS
AND DDLANGUAGE = SY-LANGU.
ENDSELECT.
The above code can be more optimized by extracting all the data from view DD01V_WA
SELECT * FROM DD01V INTO DD01V_WA
WHERE DOMNAME LIKE 'CHAR%'
AND DDLANGUAGE = SY-LANGU.
ENDSELECT
2. To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.
SELECT * FROM EKKO INTO EKKO_WA.
SELECT * FROM EKAN INTO EKAN_WA
WHERE EBELN = EKKO_WA-EBELN.
ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
FROM EKKO AS P INNER JOIN EKAN AS F
ON PEBELN = FEBELN.
3. Instead of using nested Select loops it is often better to use subqueries.
SELECT * FROM SPFLI
INTO TABLE T_SPFLI
WHERE CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK'.
SELECT * FROM SFLIGHT AS F
INTO SFLIGHT_WA
FOR ALL ENTRIES IN T_SPFLI
WHERE SEATSOCC < F~SEATSMAX
AND CARRID = T_SPFLI-CARRID
AND CONNID = T_SPFLI-CONNID
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
The above mentioned code can be even more optimized by using subqueries instead of for all entries.
SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
WHERE SEATSOCC < F~SEATSMAX
AND EXISTS ( SELECT * FROM SPFLI
WHERE CARRID = F~CARRID
AND CONNID = F~CONNID
AND CITYFROM = 'FRANKFURT'
AND CITYTO = 'NEW YORK' )
AND FLDATE BETWEEN '19990101' AND '19990331'.
ENDSELECT.
1. Table operations should be done using explicit work areas rather than via header lines.
READ TABLE ITAB INTO WA WITH KEY K = 'X BINARY SEARCH.
IS MUCH FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY K = 'X'.
If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
2. Always try to use binary search instead of linear search. But dont forget to sort your internal table before that.
READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
3. A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
4. A binary search using secondary index takes considerably less time.
5. LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
LOOP AT ITAB INTO WA WHERE K = 'X'.
ENDLOOP.
The above code is much faster than using
LOOP AT ITAB INTO WA.
CHECK WA-K = 'X'.
ENDLOOP.
6. Modifying selected components using MODIFY itab TRANSPORTING f1 f2.. accelerates the task of updating a line of an internal table.
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
The above code is more optimized as compared to
WA-DATE = SY-DATUM.
MODIFY ITAB FROM WA INDEX 1.
7. Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
Modifying selected components only makes the program faster as compared to Modifying all lines completely.
e.g,
LOOP AT ITAB ASSIGNING <WA>.
I = SY-TABIX MOD 2.
IF I = 0.
<WA>-FLAG = 'X'.
ENDIF.
ENDLOOP.
The above code works faster as compared to
LOOP AT ITAB INTO WA.
I = SY-TABIX MOD 2.
IF I = 0.
WA-FLAG = 'X'.
MODIFY ITAB FROM WA.
ENDIF.
ENDLOOP.
8. If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
LOOP AT ITAB1 INTO WA1.
READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
IF SY-SUBRC = 0.
ADD: WA1-VAL1 TO WA2-VAL1,
WA1-VAL2 TO WA2-VAL2.
MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
ELSE.
INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
ENDIF.
ENDLOOP.
The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
LOOP AT ITAB1 INTO WA.
COLLECT WA INTO ITAB2.
ENDLOOP.
SORT ITAB2 BY K.
COLLECT, however, uses a hash algorithm and is therefore independent
of the number of entries (i.e. O(1)) .
9. "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to LOOP-APPEND-ENDLOOP.
APPEND LINES OF ITAB1 TO ITAB2.
This is more optimized as compared to
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
10. DELETE ADJACENT DUPLICATES accelerates the task of deleting duplicate entries considerably as compared to READ-LOOP-DELETE-ENDLOOP.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
This is much more optimized as compared to
READ TABLE ITAB INDEX 1 INTO PREV_LINE.
LOOP AT ITAB FROM 2 INTO WA.
IF WA = PREV_LINE.
DELETE ITAB.
ELSE.
PREV_LINE = WA.
ENDIF.
ENDLOOP.
11. "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to DO -DELETE-ENDDO.
DELETE ITAB FROM 450 TO 550.
This is much more optimized as compared to
DO 101 TIMES.
DELETE ITAB INDEX 450.
ENDDO.
12. Copying internal tables by using ITAB2[ ] = ITAB1[ ] as compared to LOOP-APPEND-ENDLOOP.
ITAB2[] = ITAB1[].
This is much more optimized as compared to
REFRESH ITAB2.
LOOP AT ITAB1 INTO WA.
APPEND WA TO ITAB2.
ENDLOOP.
13. Specify the sort key as restrictively as possible to run the program faster.
SORT ITAB BY K. makes the program runs faster as compared to SORT ITAB.
Internal Tables contd
Hashed and Sorted tables
1. For single read access hashed tables are more optimized as compared to sorted tables.
2. For partial sequential access sorted tables are more optimized as compared to hashed tables
Hashed And Sorted Tables
Point # 1
Consider the following example where HTAB is a hashed table and STAB is a sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
This runs faster for single read access as compared to the following same code for sorted table
DO 250 TIMES.
N = 4 * SY-INDEX.
READ TABLE STAB INTO WA WITH TABLE KEY K = N.
IF SY-SUBRC = 0.
ENDIF.
ENDDO.
Point # 2
Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
LOOP AT STAB INTO WA WHERE K = SUBKEY.
ENDLOOP.
This runs faster as compared to
LOOP AT HTAB INTO WA WHERE K = SUBKEY.
ENDLOOP. -
Need help in performance tunning
Hi , i have one update statement , where it is keep on running for hours and the volume of the data is 2.2 million
version:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
below is the code :
DECLARE
Cursor C11
Is
Select Account_Num,Outlet_Num,Product_Number,Ln_Of_Biz,Generateguid('DELIVERED_PRODUCT') As Dp_Guid From (
Select Account_Num,Outlet_Num,Product_Number,Ln_Of_Biz
From transformation_flat
Group By Account_Num, Outlet_Num,Ln_Of_Biz,Product_Number
Having Count(*)> 1);
Type Actno Is Table Of Varchar2(13) Index By Binary_Integer;
Type Outlet Is Table Of NUMBER Index By Binary_Integer;
Type Pno Is Table Of VARCHAR2(255) INDEX BY BINARY_INTEGER;
Type Tn Is Table Of VARCHAR2(10) Index By Binary_Integer;
Type Vdpguid Is Table Of VARCHAR2(20) Index By Binary_Integer;
Type Vcnt Is Table Of Number Index By Binary_Integer;
Type Lob1 Is Table Of Varchar2(255) Index By Binary_Integer;
Type Offer_No Is Table Of Varchar2(255) Index By Binary_Integer;
V_Actno Actno;
V_Outlet Outlet;
V_Pno Pno;
V_Tn Tn;
V_DPGUID VDPGUID;
Vguid Varchar2(20);
V_Cnt Vcnt;
V_Lob Lob1;
V_Offer_No Offer_No;
BEGIN
Open c11;
Loop
Fetch C11 Bulk Collect Into V_Actno,V_Outlet,V_Pno,V_Lob,V_Dpguid;
Exit When C11%Notfound;
End Loop;
close c11;
Forall I In 1..V_Actno.count
Update transformation_flat Set Product_Guid=V_Dpguid(I) Where
Account_Num=V_Actno(I) And
Outlet_Num=V_Outlet(I) And
Product_Number=V_Pno(I) And
ln_of_biz=v_lob(I);
Commit;
END;
for above i do have index on that table on (account_num,outlet_num,product_number,ln_of_biz).
when i checked the memory contents for this sqlid in v$sql , below are the values :
Disk_Read:21640650
Buffer_Gets:22466856
Concurrency_Wait_Time:16923
Cluster_Wait_Time:36313694
user_io_wait_time:3594365433
I need some inputs in which area i can tune the above code..
Thanks835589 wrote:
hi i am also face same performance issue pls reply me ASApDon't use the word ASAP, it is rude and a violation of forum terms and conditions.
http://www.oracle.com/html/terms.html
>
4. Use of Community Services
Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
>
These people are for ASAP requests.
http://www.google.com/search?q=oracle+consultant
where i need to tune the queery.
pls i am eagarly waiting for that
Read and understand the links posted above
RPuttagunta wrote:
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long ... -
Need help in combining two similair SQLs into one
DB Version:10gR2
I need to combine the following two queries into one query and return the following three columns
Unprocessed Quantity1,Unprocessed Quantity2, Total Uprocessed Cost
Unprocessed Quantity1 can be determined using
select t.ITEM, sum(t.QTY)
from (select cd.ITEM_ID ITEM, cd.ACTL_QTY QTY
from CONVEY_HDR ch, CURRENT_INVN cd, ALLOC_HDR ah
where ........
UNION
select sd.ITEM_ID ITEM, sd.INVN_QTY QTY
from shp_dtl pd
UNION
Select item_id, inv_qty from another table
GROUP BY.....
ITEM SUM(T.QTY)
88JAT 25
000002395 1
300108396 27
000004397 7
73984290 15Unprocessed quantity2 can be determined using
select t.ITEM, sum(t.QTY)
from (select cd.ITEM_ID ITEM, cd.ACTL_QTY QTY
from CONVEY_HDR ch, CURRENT_INVN cd, ALLOC_HDR ah
where rownum<6
group by t.ITEM
order by t.ITEM;
ITEM SUM(T.QTY)
189436171 2
009438837 160
000040685 16
000032410 18Total Unprocessed Cost can found using the sum of Quantities for a particular Item from above two queries multiplied by
ITEM_COST for that ITEM (which is found in ITEM_DTL table). For every item; ITEM_DTL.item_id=CARTON_dTL.carton_id
Total Unprocessed Cost= (Unprocessed Quantity1+Unprocessed Quantity2)*ITEM_DTL. ITEM_COST
Note: Unprocessed Quantity2 query looks very similair to first SQL in UNION of Unprocessed Quantity1, but ah.STAT_CODE < 90 for Unprocessed Quantity2 query
Edited by: user636669 on Jan 14, 2009 10:40 AM
Edited by: user636669 on Jan 14, 2009 10:57 AM
Corrected typo
Edited by: user636669 on Jan 14, 2009 7:07 PMHi,
Put the two queries you posted in sub-queries. You can then use their result sets as if they were tables.
Do something like this:
WITH uq1 AS
select t.ITEM, sum(t.QTY) AS total
from (select cd.ITEM_ID ITEM, cd.ACTL_QTY QTY
from CASE_HDR ch, CASE_DTL cd, ASN_HDR ah
... the rest of your first query goes here
, uq2 AS
select t.ITEM, sum(t.QTY) AS total
from (select cd.ITEM_ID ITEM, cd.ACTL_QTY QTY
from CASE_HDR ch, CASE_DTL cd, ASN_HDR ah
... the rest of your second query goes here
SELECT uq1.item
, uq1.total AS "Unprocessed Quantity1"
, uq2.total AS "Unprocessed Quantity2"
, (uq1.total + uq2.total) * dtl.item_cost
AS "Total Uprocessed Cost"
FROM uq1
JOIN uq2 ON uq1.item = uq2.item
JOIN item_dtl dtl ON uq1.item = dtl.item;If some items are in uq1 but not in uq2 (or vice-versa), then you'll probably want to do outer joins.
I don't have any of the tables used, so I can't test this myself.
If you need more help. then post a little sample data from each of the tables, and the results you want from that data.
It looks like you're doing the same join in each of your original queries.
You can add another sub-query that does that join once, and then use that sub-query in sub-queries uq1 and uq2. -
I need help with network install of SQL Developer 3.2
All,
Does anyone have any references on how to perform a network install for SQL Developer? Here is what I'm trying to achieve:
1. Network installation on drive S:\ (Windows, obviously)
2. User links to network installation
3. Connections are unique for each user
I found the 2006 posting of network install for Raptor, but I could not find anything that correlates with the latest release. All I have done so far is downloaded and unzipped. Any help/instructions/guides/tutorials are welcome.You have installed!. The code for SQLDeveloper does not have an installer.
If the software is on S, say a shared drive, each user will start sqldeveloper and a directory called sqldeveloper will be created in their local %APPLICATION_DATA% folder. This will keep all connections etc unique for all users.
You will have to create a link from the S drive to the sqldeveloper.exe if you want a shortcut to start it. We dont provide it.
Thanks
B -
Need help with ASA 5512 and SQL port between DMZ and inside
Hello everyone,
Inside is on gigabitEthernet0/1 ip 192.9.200.254
I have a dmz on gigabitEthernet2 ip 192.168.100.254
I need to pass port 443 from outside to dmz ip 192.168.100.80 and open port 1433 from 192.168.100.80 to the inside network.
I believe this will work for port 443:
object network dmz
subnet 192.168.100.0 255.255.255.0
object network webserver
host 192.168.100.80
object network webserver
nat (dmz,outside) static interface service tcp 443 443
access-list Outside_access_in extended permit tcp any object webserver eq 443
access-group Outside_access_in in interface Outside
However...How would I open only port 1433 from dmz to inside?
At the bottom of this message is my config if it helps.
Thanks,
John Clausen
Config:
: Saved
ASA Version 9.1(2)
hostname ciscoasa-gcs
domain-name router.local
enable password f4yhsdf.4sadf977 encrypted
passwd f4yhsdf.4sadf977 encrypted
names
ip local pool vpnpool 192.168.201.10-192.168.201.50
interface GigabitEthernet0/0
nameif outside
security-level 0
ip address 123.222.222.212 255.255.255.224
interface GigabitEthernet0/1
nameif inside
security-level 100
ip address 192.9.200.254 255.255.255.0
interface GigabitEthernet0/2
nameif dmz
security-level 100
ip address 192.168.100.254 255.255.255.0
interface GigabitEthernet0/3
shutdown
no nameif
no security-level
no ip address
interface GigabitEthernet0/4
shutdown
no nameif
no security-level
no ip address
interface GigabitEthernet0/5
shutdown
no nameif
no security-level
no ip address
interface Management0/0
management-only
nameif management
security-level 100
ip address 192.168.1.1 255.255.255.0
ftp mode passive
dns server-group DefaultDNS
domain-name router.local
object network inside-subnet
subnet 192.9.200.0 255.255.255.0
object network netmotion
host 192.9.200.6
object network inside-network
subnet 192.9.200.0 255.255.255.0
object network vpnpool
subnet 192.168.201.0 255.255.255.192
object network NETWORK_OBJ_192.168.201.0_26
subnet 192.168.201.0 255.255.255.192
object network NETWORK_OBJ_192.9.200.0_24
subnet 192.9.200.0 255.255.255.0
access-list outside_access_in extended permit icmp any4 any4 log disable
access-list Outside_access_in extended permit udp any object netmotion eq 5020
access-list split standard permit 192.9.200.0 255.255.255.0
access-list VPNT_splitTunnelAcl standard permit 192.9.200.0 255.255.255.0
pager lines 24
logging asdm informational
mtu outside 1500
mtu inside 1500
mtu management 1500
mtu dmz 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
no arp permit-nonconnected
nat (inside,outside) source static inside-network inside-network destination static vpnpool vpnpool
nat (inside,outside) source static NETWORK_OBJ_192.9.200.0_24 NETWORK_OBJ_192.9.200.0_24 destination static NETWORK_OBJ_192.168.201.0_26 NETWORK_OBJ_192.168.201.0_26 no-proxy-arp route-lookup
object network netmotion
nat (inside,outside) static interface service udp 5020 5020
nat (inside,outside) after-auto source dynamic any interface
access-group Outside_access_in in interface outside
route outside 0.0.0.0 0.0.0.0 123.222.222.1 1
timeout xlate 3:00:00
timeout pat-xlate 0:00:30
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
user-identity default-domain LOCAL
http server enable
http 192.168.1.0 255.255.255.0 management
http 192.9.200.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart
crypto ipsec ikev1 transform-set ESP-3DES-MD5 esp-3des esp-md5-hmac
crypto ipsec ikev1 transform-set ESP-DES-MD5 esp-des esp-md5-hmac
crypto ipsec ikev1 transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
crypto ipsec ikev1 transform-set ESP-AES-128-SHA esp-aes esp-sha-hmac
crypto ipsec ikev1 transform-set ESP-AES-192-SHA esp-aes-192 esp-sha-hmac
crypto ipsec ikev1 transform-set ESP-AES-128-MD5 esp-aes esp-md5-hmac
crypto ipsec ikev1 transform-set ESP-AES-192-MD5 esp-aes-192 esp-md5-hmac
crypto ipsec ikev1 transform-set ESP-AES-256-SHA esp-aes-256 esp-sha-hmac
crypto ipsec ikev1 transform-set ESP-AES-256-MD5 esp-aes-256 esp-md5-hmac
crypto ipsec ikev1 transform-set ESP-DES-SHA esp-des esp-sha-hmac
crypto ipsec security-association pmtu-aging infinite
crypto dynamic-map SYSTEM_DEFAULT_CRYPTO_MAP 65535 set pfs group5
crypto dynamic-map SYSTEM_DEFAULT_CRYPTO_MAP 65535 set ikev1 transform-set ESP-AES-128-SHA ESP-AES-128-MD5 ESP-AES-192-SHA ESP-AES-192-MD5 ESP-AES-256-SHA ESP-AES-256-MD5 ESP-3DES-SHA ESP-3DES-MD5 ESP-DES-SHA ESP-DES-MD5
crypto map outside_map 65535 ipsec-isakmp dynamic SYSTEM_DEFAULT_CRYPTO_MAP
crypto map outside_map interface outside
crypto ca trustpool policy
crypto ikev1 enable outside
crypto ikev1 policy 10
authentication crack
encryption aes-256
hash sha
group 2
lifetime 86400
crypto ikev1 policy 20
authentication rsa-sig
encryption aes-256
hash sha
group 2
lifetime 86400
crypto ikev1 policy 30
authentication pre-share
encryption aes-256
hash sha
group 2
lifetime 86400
crypto ikev1 policy 40
authentication crack
encryption aes-192
hash sha
group 2
lifetime 86400
crypto ikev1 policy 50
authentication rsa-sig
encryption aes-192
hash sha
group 2
lifetime 86400
crypto ikev1 policy 60
authentication pre-share
encryption aes-192
hash sha
group 2
lifetime 86400
crypto ikev1 policy 70
authentication crack
encryption aes
hash sha
group 2
lifetime 86400
crypto ikev1 policy 80
authentication rsa-sig
encryption aes
hash sha
group 2
lifetime 86400
crypto ikev1 policy 90
authentication pre-share
encryption aes
hash sha
group 2
lifetime 86400
crypto ikev1 policy 100
authentication crack
encryption 3des
hash sha
group 2
lifetime 86400
crypto ikev1 policy 110
authentication rsa-sig
encryption 3des
hash sha
group 2
lifetime 86400
crypto ikev1 policy 120
authentication pre-share
encryption 3des
hash sha
group 2
lifetime 86400
crypto ikev1 policy 130
authentication crack
encryption des
hash sha
group 2
lifetime 86400
crypto ikev1 policy 140
authentication rsa-sig
encryption des
hash sha
group 2
lifetime 86400
crypto ikev1 policy 150
authentication pre-share
encryption des
hash sha
group 2
lifetime 86400
telnet 192.9.200.0 255.255.255.0 inside
telnet timeout 5
ssh timeout 5
ssh key-exchange group dh-group1-sha1
console timeout 0
dhcpd address 192.168.1.2-192.168.1.254 management
dhcpd enable management
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
ssl encryption aes128-sha1 3des-sha1
webvpn
enable outside
anyconnect image disk0:/anyconnect-win-2.5.2014-k9.pkg 2 regex "Windows NT"
anyconnect image disk0:/anyconnect-macosx-i386-2.5.2014-k9.pkg 3 regex "Intel Mac OS X"
anyconnect enable
tunnel-group-list enable
group-policy SSLVPN internal
group-policy SSLVPN attributes
dns-server value 192.9.200.13
vpn-tunnel-protocol ssl-client
split-tunnel-policy tunnelspecified
split-tunnel-network-list value split
default-domain value router.local
group-policy VPNT internal
group-policy VPNT attributes
dns-server value 192.9.200.13
vpn-tunnel-protocol ikev1 l2tp-ipsec
split-tunnel-policy tunnelspecified
split-tunnel-network-list value VPNT_splitTunnelAcl
default-domain value router.local
username grimesvpn password 7.wersfhyt encrypted
username grimesvpn attributes
service-type remote-access
tunnel-group SSLVPN type remote-access
tunnel-group SSLVPN general-attributes
address-pool vpnpool
default-group-policy SSLVPN
tunnel-group SSLVPN webvpn-attributes
group-alias SSLVPN enable
tunnel-group VPNT type remote-access
tunnel-group VPNT general-attributes
address-pool vpnpool
default-group-policy VPNT
tunnel-group VPNT ipsec-attributes
ikev1 pre-shared-key *****
class-map inspection_default
match default-inspection-traffic
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
inspect ip-options
inspect icmp
service-policy global_policy global
prompt hostname context
no call-home reporting anonymous
Cryptochecksum:36271b5a1b9382621e14c3aa635e2fbb
: endHi Vibor. Apologies if my comment was misunderstood. What I meant to say was that the security level of the dmz interface should probably be less than 100.
And therefore traffic could be controlled between DMZ and inside networks.
As per thr security level on the DMZ interface. ....... that command is correct. :-)
Maybe you are looking for
-
How do you get movies in iTunes from the iMovie app?
When I want to export a movie from iMovie, I "Send project to - iTunes". .........the screen says "Send to iTunes complete, your project will appear in the File Sharing section of iTunes as: My Project" The problem is, is that I can't find where the
-
Js folder not included in OAM, or web folder when published
I'm sure I'm doing something wrong, but I've check a few video tuts and don't appear to have my structure wrong. see attached. But when I Publish the index.html for both web and OAM, the js folder and the fonts folder are not copied to the "web" fold
-
Substring with a dynamic length
Hi All. I need to convert the URL that comes as a https to http. This URL is dynamic and so im not able to give the 'To' value when trying to use the substring functionality. If i have a URL as https://forums.sdn.sap then i need to convert this as ht
-
How to judge some jcomponent whether has gotten focus?
1.How to judge some JComponent whether has gotten focus? 2.How to judge what JComponent has gotten focus?
-
Route schedule and Route Combination
Hi Experts , I have a Sales Order . Now Under schedule Line Tab I see two schedule Lines ,one line with confirmed quantity now, each schedule Line with different route schedule . I would Like to Know , how the system understands when and which route