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: pgsql-general(at)postgresql(dot)org
Subject: Re: How to delete duplicate rows?
Date: 2005-02-04 07:38:26
Message-ID: 42032672.1000702@wardbrook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can you not use your table's primary key value instead?

If you table is created with OIDs you may be able to use those -
although I don't know if that this advisable or not since I never use
OIDs...

John Sidney-Woollett

Clodoaldo Pinto wrote:

> This one must be obvious for most here.
>
> I have a 170 million rows table from which I want to eliminate
> duplicate "would be" keys and leave only uniques.
>
> I found a query in http://www.jlcomp.demon.co.uk/faq/duplicates.html
> for the oracle database but can't figure out how to refer to the row
> id in postgresql:
>
> delete from test where rowid not in
> (select min(rowid) from test group by a,b);
>
> How to refer to the row id? Any better way to do it?
>
> Regards, Clodoaldo Pinto
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2005-02-04 07:57:53 Re: Applications that leak connections
Previous Message Philippe Schmid 2005-02-04 07:32:28 Re: Start problem on OSX