Neil Conway wrote: > So I think it should be possible to lock both the heap relation and the > index with ExclusiveLock, which would allow SELECTs on them. This would > apply to both the single relation and multiple relation variants of > CLUSTER (since we do each individual clustering in its own transaction). > > ... except that when we rebuild the relation's indexes, we acquire an > AccessExclusiveLock on the index. This would introduce the risk of > deadlock. It seems necessary to acquire an AccessExclusiveLock when > rebuilding shared indexes, since we do the index build in-place, but I > think we can get by with an ExclusiveLock in the non-shared case, for > similar reasons as above: we build the new index and then swap relfilenodes.
Certainly we need to upgrade to an exclusive table lock to replace the heap table. Do we want to get a shared lock and possibly starve waiting for an exclusive lock on the table to swap the new one in? Do we do such escallation anywhere else? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings