Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 620281336FA7 for ; Sat, 26 Feb 2011 13:25:40 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 35843-06 for ; Sat, 26 Feb 2011 17:25:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 16AB41337B8D for ; Sat, 26 Feb 2011 13:25:32 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p1QHPWYp020324; Sat, 26 Feb 2011 12:25:32 -0500 (EST) To: Bhakti Ghatkar cc: pgsql-performance@postgresql.org Subject: Re: Vacuum problem due to temp tables In-reply-to: References: Comments: In-reply-to Bhakti Ghatkar message dated "Sat, 26 Feb 2011 12:30:58 +0530" Date: Sat, 26 Feb 2011 12:25:32 -0500 Message-ID: <20323.1298741132@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/500 X-Sequence-Number: 42638 Bhakti Ghatkar writes: > We were running full vacuum on DB when we encountered the error below; > INFO: vacuuming "pg_catalog.pg_index" > *vacuumdb: vacuuming of database "rpt_production" failed: ERROR: duplicate > key value violates unique constraint "pg_index_indexrelid_index"* > DETAIL: Key (indexrelid)=(2678) already exists. That's pretty bizarre, but what makes you think it has anything to do with temp tables? OID 2678 is pg_index_indexrelid_index itself. It looks to me like you must have duplicate rows in pg_index for that index (and maybe others?), and the problem is exposed during vacuum full because it tries to rebuild the indexes. Could we see the output of select ctid,xmin,xmax,* from pg_index where indexrelid in (select indexrelid from pg_index group by 1 having count(*)>1); regards, tom lane