Re: How to delete duplicate rows?

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

Doh, sorry - you're completely correct! Silly me...

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?

John Sidney-Woollett

Clodoaldo Pinto wrote:

> On Fri, 04 Feb 2005 07:38:26 +0000, John Sidney-Woollett
> <johnsw(at)wardbrook(dot)com> wrote:
>
>>Can you not use your table's primary key value instead?
>>
>
> John, If a primary key existed there would be no duplicates.
>
> The row insertion is made in 650k rows batches 8 times a day and a
> primary key make it very slow.
>
> Found also methods 2 and 3 in
> http://www.orafaq.com/faq/Server_Utilities/SQL/faq55.htm
>
> 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.
>
> Clodoaldo

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2005-02-04 10:50:23 Re: Invalid headers and xlog flush failures
Previous Message Tatsuo Ishii 2005-02-04 10:10:11 Re: pgpool 2.5b2 released