X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1EE445281C for ; Wed, 25 May 2005 14:44:59 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57874-09 for ; Wed, 25 May 2005 17:44:56 +0000 (GMT) Received: from mr2.surnet.cl (smtp2.surnet.cl [216.155.73.163]) by svr1.postgresql.org (Postfix) with ESMTP id 6F46852803 for ; Wed, 25 May 2005 14:44:56 -0300 (ADT) Received: from smtp2.surnet.cl (216.155.73.169) by mr2.surnet.cl (7.0.031.3) id 4259ADFA009D463A; Wed, 25 May 2005 13:45:22 -0400 Received: from smtp2.surnet.cl (mr2.surnet.cl []) by mr2.surnet.cl ([216.155.73.169]); Wed, 25 May 2005 17:45:22 +0000 Received: from cluster.surnet.cl (216.155.73.164) by smtp2.surnet.cl (7.0.031.3) id 4259ADE3005E473F; Wed, 25 May 2005 13:45:22 -0400 Received: from localhost (216.155.79.6) by cluster.surnet.cl (7.0.024) id 4276578F00329966; Wed, 25 May 2005 13:44:56 -0400 Received: by localhost (Postfix, from userid 1000) id C9127C91E42; Wed, 25 May 2005 13:44:56 -0400 (CLT) Date: Wed, 25 May 2005 13:44:56 -0400 From: Alvaro Herrera To: lucas@presserv.org Cc: pgsql-sql@postgresql.org Subject: Re: Duplicated records Message-ID: <20050525174456.GC8590@surnet.cl> References: <20050524175931.4dp41vy7v10c4wc4@www.presserv.org> <20050525050346.GA29126@webserv.wug-glas.de> <20050525135807.x9p08co04v8gg0cw@www.presserv.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050525135807.x9p08co04v8gg0cw@www.presserv.org> User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.696 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200505/217 X-Sequence-Number: 21530 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 () "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)