Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group