On Thu, Dec 17, 2015 at 9:33 PM, Aleksander Alekseev <a.alekseev@postgrespro.ru> wrote: > > > It'd really like to see it being replaced by a queuing lock > > (i.e. lwlock) before we go there. And then maybe partition the > > freelist, and make nentries an atomic. > > I believe I just implemented something like this (see attachment). The > idea is to partition PROCLOCK hash table manually into NUM_LOCK_ > PARTITIONS smaller and non-partitioned hash tables. Since these tables > are non-partitioned spinlock is not used and there is no lock > contention. >
This idea can improve the situation with ProcLock hash table, but I
think IIUC what Andres is suggesting would reduce the contention
around dynahash freelist and can be helpful in many more situations