Removing Duplicate Rows [message #374085] |
Thu, 24 May 2001 03:21 |
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 |
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.
|
|
|