pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shankar K <shan0075@yahoo.com>
To: pgsql-performance@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Rebuild indexes
Date: Mon, 28 Jul 2003 14:29:05 -0700 (PDT)
Message-ID: <20030728212905.79549.qmail@web21102.mail.yahoo.com> (raw)

Hi Everyone,

I've a kind of less inserts/mostly updates table,
which we vacuum every half-hour. 

here is the output of vacuum analyze 

INFO:  --Relation public.accounts--
INFO:  Index accounts_u1: Pages 1498; Tuples 515:
Deleted 179.
	CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO:  Index accounts_u2: Pages 2227; Tuples 515:
Deleted 179.
	CPU 0.00s/0.00u sec elapsed 0.01 sec.
INFO:  Index accounts_u3: Pages 246; Tuples 515:
Deleted 179.
	CPU 0.00s/0.00u sec elapsed 0.00 sec.

however its indexes keeps growing on and on. After
surfing the manuals for a while, i came to know that
vacuum doesn't clears up dead tuples caused by
updates. so i then decided to do reindex online, but
that makes exclusive lock on table which would prevent

writing on to tables.

finally i'm at a point where i decided to do index
swapping.

for e.g.

1. create index accounts_u1_swap,accounts_u2_swap and
accounts_u3_swap in addition to the original indexes

2. analyze table to update stats, so that the table
knows about new indexes.

3. drop original indexes

4. i wish i had a rename index command to rename _swap
to its original index name. now create indexes with
original name

5. follow #2  and #3 (now drop _swap indexes)

Is there a better way to do this. comments are
appreciated.

thanks
-Shankar

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



view thread (4+ messages)  latest in thread

Message-ID: <20030728212905.79549.qmail@web21102.mail.yahoo.com>
Permalink:  ../20030728212905.79549.qmail@web21102.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030728212905.79549.qmail@web21102.mail.yahoo.com

 · 

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-performance@postgresql.org
  Cc: shan0075@yahoo.com, pgsql-admin@postgresql.org
  Subject: Re: Rebuild indexes
  In-Reply-To: <20030728212905.79549.qmail@web21102.mail.yahoo.com>
  References: <20030728212905.79549.qmail@web21102.mail.yahoo.com>

* 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