Re: Re: Need for rebuilding index after many deletions?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: philip(at)adhesivemedia(dot)com (Philip Hallstrom)
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Need for rebuilding index after many deletions?
Date: 2000-08-06 05:40:46
Message-ID: 24236.965540446@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>> With Postgres 6.5.2, if a table has undergone several row deletions,
>>> does it make sense/ is it needed to rebuild the index?

If you've deleted a large fraction of the rows in the table, dropping
and recreating the indexes would be worth doing, because VACUUM by
itself won't reclaim unused space in an index.

BTW, many people have found that
drop indexes;
VACUUM;
rebuild indexes;
is actually faster than letting VACUUM try to vacuum the indexes.
One of the things on the to-do list is to redesign VACUUM so that it
handles indexes this way internally.

> I could be wrong, but you also need the -a (analyze) option to vacuum to
> have it "re-think" it's lookup strategies, right?

Doesn't have anything to do with index efficiency. If the table stats
(column min/max values, etc) have changed a lot then it's worth doing
"analyze" again to update pg_statistic. But in many cases you don't
need to do "analyze" nearly as often as basic "vacuum".

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alex Pilosov 2000-08-06 06:03:13 Re: libperl.so
Previous Message Dale Walker 2000-08-06 04:24:12 Table Design: Timestamp vs time/date