Hi, On 2021-04-13 19:16:46 -0400, Tom Lane wrote: > > Maybe the same thing we do with user tables, ie not give up the lock > > when we close a toast rel? As long as the internal lock counters > > are 64-bit, we'd not have to worry about overflowing them. Well, I was assuming we'd not want to do that, but I am generally on board with the concept (and think our early lock release in a bunch of places is problematic). > Like this? This passes check-world, modulo the one very-unsurprising > regression test change. I've not tried to do any performance testing. I wonder if there's a realistic chance it could create additional deadlocks that don't exist right now? Would it be a problem that we'd still release the locks on catalog tables early, but not on its toast table? Greetings, Andres Freund