"Steven Flatt" <steven(dot)flatt(at)gmail(dot)com> writes:
> Interestingly enough, the example you've given does not work for me either.
> The select count(*) from test blocks until the reindex completes. Are we
> using the same pg version?
Seems like a fair question, because Greg's example blocks for me too,
in plancat.c where the planner is trying to acquire information on each
index. This seems to be an unwanted side effect of this 8.2-era patch
specifically, note here
how the new planner coding takes at least AccessShareLock on each index,
where the old coding took no lock at all.
I think that the new coding rule of "you *must* take some lock when
opening the relation" is essential for tables, but it might not be
necessary for indexes if you've got a lock on the parent table.
We don't allow any schema changes on an index to be made without holding
exclusive lock on the parent, so plancat.c's basic purpose of finding
out the properties of the index could be done safely without any index
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
So maybe we are stuck and we have to say "that doesn't work anymore".
But it feels like we might not be too far away from letting it still
work. Thoughts, ideas?
regards, tom lane
In response to
pgsql-performance by date
|Next:||From: Mark Kirkwood||Date: 2007-08-24 05:11:31|
|Subject: Re: When/if to Reindex|
|Previous:||From: Tom Lane||Date: 2007-08-24 02:19:40|
|Subject: Re: Optimising "in" queries |