RE: [HACKERS] Index recreation in vacuum

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dmitry Samersoff" <dms(at)wplus(dot)net>, "pgsql-hackers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: [HACKERS] Index recreation in vacuum
Date: 2000-01-19 00:35:58
Message-ID: 000101bf6215$27831300$2801007e@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
>
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > The beauty of doing a temp index while keeping the old one is that you
> > > can recover right away, and maybe allow the old index to be used while
> > > you vacuum?
> >
> > Huh? You've got the whole table locked exclusively for the duration
> > of the vacuum anyway.
> >
> > In fact, the instant that vacuum does its internal commit, the old index
> > contents are actually *wrong*, and there is no possible value in keeping
> > them after that. Might as well blow them away and recover the disk
> > space for use in constructing the new indexes.
>
> Oh, I thought the vacuum itself would use the index during processing.
>

It's a big charge for vacuum to keep consistency between heap table and
indexes. The main point of index recreation in vacuum is to invalidate the
indexes of the target table. Temp indexes or renaming technique is no
longer needed once indexes are invalidated.

Once again,how to invalidate/validate indexes ?

I want to avoid dropping indexes because the definition is lost and
'commit' is needed internally.

My proposal is to use relhasindex of pg_class.
How about ?
relhasindex is true -- all indexes of the table are valid if the table has
indexes.
relhasindex is false -- either the table has no indexes or all indexes
of the table are invalid

CREATE INDEX/DROP INDEX/DROP TABLE/VACUUM/REINDEX
would be able to ignore relhasindex.

Am I misusing relhasindex ?

If reindexing vacuum crashes,indexes of the target table would be invalid.
To recover indexes there would be 2 ways.
1) vacuum again
2) reindex the table

Note that we would be able to REINDEX user tables under postmaster.

Comments ?

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-01-19 00:36:00 Re: [HACKERS] gperf anyone?
Previous Message Peter Eisentraut 2000-01-18 23:43:36 Re: [HACKERS] multi-byte support broken in current