PL/SQL (MOSC)

MOSC Banner

Performance improvement

in PL/SQL (MOSC) 2 commentsAnswered

I am trying to find ways to improve performance with existing PL/SQL block of code which is an equivalent of a MERGE statement. Could you please review following code snippet and suggest best practices or updates to improve the performance? I am thinking in the lines of using collections, FORALL, and BULCOLLECT.


Truncate a staging table

Insert into staging SELECT from external table. The external table may contain millions of rows. A hint has been used in the insert (--+append).

Gather table stats on the staging table : dbms_stats.gather_table_stats - cascade => TRUE

for loop (select * from staging)
         update target_table(20 million rows) , 45 columns out of a total of 54 columns with a where condition on two columns. Two of the columns that gets updated are using SYSDATE.
        if sql%notfound then
         insert into with one of the columns generating a sequence, and two other column values are defaulted to SYSDATE

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center