Re: Duplicated records - Mailing list pgsql-sql

From Alvaro Herrera
Subject Re: Duplicated records
Date
Msg-id 20050525174456.GC8590@surnet.cl
Whole thread Raw
In response to Re: Duplicated records  (lucas@presserv.org)
List pgsql-sql
On Wed, May 25, 2005 at 01:58:07PM -0300, lucas@presserv.org wrote:

> The records is entire duplicated (with all fields having the same data),
> thinking the "numos" fields as primary key I have executed the query:
> 
> # DELETE from lanctos where not oid=(select oid from lanctos as l2 where
> l2.numos=lanctos.numos limit 1);

That's because you don't have an index on the Oid column.  You may want
to try using the ctid column instead; it's the physical row position in
the table so it doesn't need to scan the whole table each time.

HTH,

-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
"The only difference is that Saddam would kill you on private, where the
Americans will kill you in public" (Mohammad Saleh, 39, a building contractor)


pgsql-sql by date:

Previous
From: lucas@presserv.org
Date:
Subject: Re: Duplicated records
Next
From: Andreas Kretschmer
Date:
Subject: Re: [despammed] Re: Duplicated records