Home » RDBMS Server » Server Administration » Removing Duplicate Rows
Removing Duplicate Rows [message #374085] Thu, 24 May 2001 03:21 Go to next message
Angelos Tantalos
Messages: 2
Registered: May 2001
Junior Member
I have a table with nearly 600,000 rows of which 279,679 are duplicates using as primary key the seq_num column. I use the following statement:

DELETE FROM CCS_REQUEST_PLANS_BACKUP A WHERE ROWID > (SELECT MIN(ROWID) FROM CCS_REQUEST_PLANS_BACKUP B WHERE A.SEQ_NUM=B.SEQ_NUM)

The problem is that this takes ages to complete...is there any other faster way to accomplish this?..thanx!
Re: Removing Duplicate Rows [message #374090 is a reply to message #374085] Thu, 24 May 2001 10:06 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
Make sure that SEQ_NUM is indexed. Also, each additional index will slow things down.

An alternative is to select distinct rows into a temp table and then work from there. This will only work if rows are exact duplicates, not just duplicates on SEQ_NUM.
Previous Topic: View
Next Topic: Japanese string comparison?
Goto Forum:
  


Current Time: Wed Jul 03 16:55:26 CDT 2024