Re: How to delete duplicate rows?

From: Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com>
To: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>
Cc: postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to delete duplicate rows?
Date: 2005-02-04 11:11:25
Message-ID: a595de7a05020403115d1ee410@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<johnsw(at)wardbrook(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eric Jain 2005-02-04 11:17:15 Postgres using up all my memory
Previous Message Christopher Browne 2005-02-04 11:01:47 Re: Is there a peer-to-peer server solution with PG?