Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id D5894476A69 for ; Wed, 19 Jun 2002 17:55:53 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id D9EAF475B1D for ; Wed, 19 Jun 2002 17:38:12 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g5JLcA107574; Wed, 19 Jun 2002 17:38:10 -0400 (EDT) To: Brian McCane Cc: pgsql-admin@postgresql.org Subject: Re: index keeps on growing In-reply-to: <20020619160155.L2042-100000@fw.mccons.net> References: <20020619160155.L2042-100000@fw.mccons.net> Comments: In-reply-to Brian McCane message dated "Wed, 19 Jun 2002 16:24:21 -0500" Date: Wed, 19 Jun 2002 17:38:10 -0400 Message-ID: <7571.1024522690@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200206/148 X-Sequence-Number: 4582 Brian McCane writes: > I assume that if I do it in a BEGIN..COMMIT block I won't lose > anything, but I am not sure if a "DROP INDEX" can be rolled back. DROP INDEX can be rolled back in the same releases that allow DROP TABLE to be rolled back. I think we allowed that beginning in 7.0, but check the release notes. So basically you'd want BEGIN; DROP INDEX foo; either CREATE INDEX ... or ALTER TABLE ADD PRIMARY KEY ...; COMMIT; Note this will imply peak disk usage equal to size of old index plus size of new, since the old file can't physically be removed till commit. regards, tom lane