From: Steven Flatt <steven.flatt@gmail.com>
To: Mark Kirkwood <markir@paradise.net.nz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Gregory Stark <stark@enterprisedb.com>
Cc: Bill Moran <wmoran@collaborativefusion.com>
Cc: Vivek Khera <vivek@khera.org>
Cc: Pgsql performance <pgsql-performance@postgresql.org>
Subject: Re: When/if to Reindex
Date: Fri, 24 Aug 2007 10:22:38 -0400
Message-ID: <357fa7590708240722m204d678eid02b7ce3470eba1a@mail.gmail.com> (raw)
In-Reply-To: <46CE6883.10104@paradise.net.nz>
References: <357fa7590707181008k65ab2f20l55bebb3c14f52770@mail.gmail.com>
<357fa7590708081212p7b19cbbbn39dbadae8603edd6@mail.gmail.com>
<20070808152757.9eb9bbcc.wmoran@collaborativefusion.com>
<11801.1186624308@sss.pgh.pa.us>
<357fa7590708090651p71b9bc47n66739f8dbbb4ff57@mail.gmail.com>
<357fa7590708220955h441cd75ap4c0f0342a1c30a14@mail.gmail.com>
<873aybw2le.fsf@oxford.xeocode.com>
<357fa7590708231525h2f48ce4dw3e48ecca5ccddf72@mail.gmail.com>
<17370.1187927942@sss.pgh.pa.us>
<46CE6883.10104@paradise.net.nz>
On 8/24/07, Mark Kirkwood <markir@paradise.net.nz> wrote:
>
> Tom Lane wrote:
> >
> > The fly in the ointment is that after collecting the pg_index definition
> > of the index, plancat.c also wants to know how big it is --- it calls
> > RelationGetNumberOfBlocks. And that absolutely does look at the
> > physical storage, which means it absolutely is unsafe to do in parallel
> > with a REINDEX that will be dropping the old physical storage at some
> > point.
>
> A suggestion that seems a bit like a leap backwards in time - maybe just
> use the pg_class.relpages entry for the index size?
Just throwing this out there (looking from a higher level)...
Why do we even need to consider calling RelationGetNumberOfBlocks or looking
at the pg_class.relpages entry? My understanding of the expected behaviour
is that while a reindex is happening, all queries run against the parent
table are planned as though the index isn't there (i.e. it's unusable).
This may/will result in sub-optimal query plans, but the point is that
reindex never blocks readers. Not sure if from an implementation standpoint
it's easy to mark an index as "being reindexed" in which case the planner
should just skip it.
Steve
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: steven.flatt@gmail.com, markir@paradise.net.nz, tgl@sss.pgh.pa.us, stark@enterprisedb.com, wmoran@collaborativefusion.com, vivek@khera.org
Subject: Re: When/if to Reindex
In-Reply-To: <357fa7590708240722m204d678eid02b7ce3470eba1a@mail.gmail.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