pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@surnet.cl>
To: lucas@presserv.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Duplicated records
Date: Wed, 25 May 2005 13:44:56 -0400
Message-ID: <20050525174456.GC8590@surnet.cl> (raw)
In-Reply-To: <20050525135807.x9p08co04v8gg0cw@www.presserv.org>
References: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org>
	<20050525050346.GA29126@webserv.wug-glas.de>
	<20050525135807.x9p08co04v8gg0cw@www.presserv.org>

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)



view thread (8+ messages)  latest in thread

Message-ID: <20050525174456.GC8590@surnet.cl>
Permalink:  ../20050525174456.GC8590@surnet.cl/
Also on:    postgresql.org/message-id/20050525174456.GC8590@surnet.cl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@surnet.cl, lucas@presserv.org
  Subject: Re: Duplicated records
  In-Reply-To: <20050525174456.GC8590@surnet.cl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox