Alvaro Herrera <alvherre@atentus.com> writes:
> I think creating a new LWLockId (BTFreeListLock?) can help here. The
> operations on freelist are short lived and rather infrequent so it
> doesn't seem to matter that it is global to all indexes.
Seems like a really bad idea to me ... what makes you think that this
would not be a bottleneck? You'd have to take such a lock during every
index-page split, which is not that uncommon.
> Another way
> would be to create one LockId per index, but it seems a waste to me.
No, you should be looking at a way to represent index locking in the
standard lock manager, not as an LWLock. We've already got a concept
of page-level lockable entities there.
regards, tom lane