"Steven Flatt" <steven.flatt@xxxxxxxxx> 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 http://archives.postgresql.org/pgsql-committers/2006-07/msg00356.php specifically, note here http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/plancat.c.diff?r1=1.121;r2=1.122;f=h 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 lock. 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. 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 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match