On Tue, Oct 04, 2022 at 07:53:11PM -0400, Tom Lane wrote: > I wrote: >> PFA a quick-hack fix that solves this issue by making per-transaction >> subsidiary hash tables. That's overkill perhaps; I'm a little worried >> about whether this slows down normal cases more than it's worth. >> But we ought to do something about this, because aside from the >> duplication aspect the current storage of these lists seems mighty >> space-inefficient. > > After further thought, maybe it'd be better to do it as attached, > with one long-lived hash table for all the locks. This is a shade > less space-efficient than the current code once you account for > dynahash overhead, but the per-transaction overhead should be lower > than the previous patch since we only need to create/destroy a hash > table entry not a whole hash table.
This feels like a natural way to solve this problem. I saw several cases of the issue that was fixed with 6301c3a, so I'm inclined to believe this usage pattern is actually somewhat common. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com