pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brian McCane <bmccane@mccons.net>
Cc: pgsql-admin@postgresql.org
Subject: Re: index keeps on growing
Date: Wed, 19 Jun 2002 17:38:10 -0400
Message-ID: <7571.1024522690@sss.pgh.pa.us> (raw)
In-Reply-To: <20020619160155.L2042-100000@fw.mccons.net>
References: <20020619160155.L2042-100000@fw.mccons.net>

Brian McCane <bmccane@mccons.net> 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



view thread (9+ messages)  latest in thread

Message-ID: <7571.1024522690@sss.pgh.pa.us>
Permalink:  ../7571.1024522690@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7571.1024522690@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bmccane@mccons.net
  Subject: Re: index keeps on growing
  In-Reply-To: <7571.1024522690@sss.pgh.pa.us>
  References: <20020619160155.L2042-100000@fw.mccons.net> <7571.1024522690@sss.pgh.pa.us>

* 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