Removing & saving duplicate records

From: Mick Oyer <mlo_at_cray.com>
Date: 9 Aug 93 13:08:47 CDT
Message-ID: <1993Aug9.130847.22851_at_hemlock.cray.com>


Greetings.

I'm hoping some Oracle guru can suggest a (much) faster method of doing the following -

I want to collect and save duplicate records from a table. Right now I'm doing this:

        create table duplicates
        as select * from temp_table x
        WHERE ROWID > (SELECT MIN(ROWID)
                FROM temp_table y
                WHERE x.SYSTEM=y.SYSTEM
                AND x.FRM_DATE=y.FRM_DATE
                AND x.TO_DATE=y.TO_DATE)
        /
        DELETE FROM temp_table x
        	WHERE ROWID > (SELECT MIN(ROWID)
                FROM temp_table y
                WHERE x.SYSTEM=y.SYSTEM
                AND x.FRM_DATE=y.FRM_DATE
                AND x.TO_DATE=y.TO_DATE)
        /

OK, I've indexed all the fields being used, but with a table of four or five thousand rows, this takes many hours to do. Is there any way to make this run a few orders of magnitude faster. I need to do this for 5 or 6 tables, as it is now it would take a week to do this.

Any help is appreciated - E-mail preferable, I'll post a summary.

---

| Michael (Mick) Oyer EMAIL : mlo_at_cherry.cray.com || uunet!cray!mlo |
| Sr. Software Analyst VMAIL : work: (612)-683-5855 |
| Cray Research, Inc. USNAIL : 655F Lone Oak Dr., Eagan, MN 55120 |
Received on Mon Aug 09 1993 - 20:08:47 CEST

Original text of this message