Re: Delete duplicates

From: Dani Oderbolz <oderbolz(at)ecologic(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Delete duplicates
Date: 2003-06-25 08:16:35
Message-ID: 3EF95A63.6070609@ecologic.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Denis Arh wrote:

>How to delete "real" duplicates?
>
>id | somthing
>-----------------------
>1 | aaa
>1 | aaa
>2 | bbb
>2 | bbb
>
>(an accident with backup recovery...)
>
In these cases, its certainly the best to rebuild your table
using a

CREATE TABLE new AS
SELECT col1,col1..
FROM old
GROUPY BY col1,col2...

If you have got many duplicates, recreating a new table
semms better to me than deleteing.
(Another advantage is that you still have the "bad" table as a record).

Cheers,
Dani

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Vangelis-Maria Tougia 2003-06-25 09:00:00 UPDATE table SET col = (SELECT ...)
Previous Message Frankie Lam 2003-06-25 06:19:09 Re: database & table size