SQL Performance (MOSC)

MOSC Banner

Fine tune the querry

edited Jul 9, 2013 7:12PM in SQL Performance (MOSC) 7 commentsAnswered ✓
Hello All,

im trying to loop throught the table and look for duplicate records and delete the duplicate records using the below query

For Mcur In ( select Max(empiid) empiid ,MAx(ROWID) MaxROWID from emp
       group by  empiid having count(*)>1)
   Loop
         Delete from emp where empiid=Mcur.empiid and RowId<Mcur.MaxROWID;
   End Loop;

Its taking more then 5hrs to complete, can i request your help on fine tunning the query so that it deletes the records within few minitues,

Thanks

sankar

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