Re: Duplicated records

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: lucas(at)presserv(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Duplicated records
Date: 2005-05-25 17:44:56
Message-ID: 20050525174456.GC8590@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, May 25, 2005 at 01:58:07PM -0300, lucas(at)presserv(dot)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)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2005-05-25 17:57:02 Re: [despammed] Re: Duplicated records
Previous Message lucas 2005-05-25 16:58:07 Re: Duplicated records