Re: How to delete duplicate rows? - Mailing list pgsql-general

From Clodoaldo Pinto
Subject Re: How to delete duplicate rows?
Date
Msg-id a595de7a05020403115d1ee410@mail.gmail.com
Whole thread Raw
In response to Re: How to delete duplicate rows?  (John Sidney-Woollett <johnsw@wardbrook.com>)
List pgsql-general
<johnsw@wardbrook.com> wrote:
>
> Can you not add a serial or sequence column to the table for the
> purposes of the de-dupe?
>
> Then create an index on that column in one operation at the end and use
> that in the way that you would use Oracle's rowid from the examples?

Yes. It could work. I have a two hours window to do it. Creating the
index alone takes about one hour...

> Clodoaldo Pinto wrote:
>
> > Method 3 also relies in the row id. If no one can help I will do this:
> >
> > Insert the distinct rows in a temporary table. Drop the index. Insert
> > into the original from the temporary.
> >
How did i wrote it? The correct is:

Insert the distinct rows in a temporary table. Truncate the original.
Drop the index. Insert into the original from the temporary.  Recreate
the index.

Clodoaldo

pgsql-general by date:

Previous
From: Mike Nolan
Date:
Subject: Re: Is there a peer-to-peer server solution with PG?
Next
From: Eric Jain
Date:
Subject: Postgres using up all my memory