index_destroy() must grab exclusive access to the parent table
of the index it wants to destroy. This ensures that no other backend is actively scanning or updating that index. Getting exclusive access on the index alone is NOT sufficient, because the executor is rather cavalier about getting locks on indexes --- see ExecOpenIndices(). It might be better to grab index locks in the executor, but I'm not sure the extra lockmanager traffic is really worth it just to make index_destroy cleaner.
Showing
Please register or sign in to comment