Re: cheaper snapshots redux - Mailing list pgsql-hackers

From Markus Wanner
Subject Re: cheaper snapshots redux
Date
Msg-id 4E54B6AC.3000607@bluegap.ch
Whole thread Raw
In response to Re: cheaper snapshots redux  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: cheaper snapshots redux
List pgsql-hackers
Robert, Jim,

thanks for thinking out loud about dynamic allocation of shared memory.Very much appreciated.

On 08/23/2011 01:22 AM, Robert Haas wrote:
> With respect to a general-purpose shared memory allocator, I think
> that there are cases where that would be useful to have, but I don't
> think there are as many of them as many people seem to think.  I
> wouldn't choose to implement this using a general-purpose allocator
> even if we had it, both because it's undesirable to allow this or any
> subsystem to consume an arbitrary amount of memory (nor can it fail...
> especially in the abort path) and because a ring buffer is almost
> certainly faster than a general-purpose allocator.

I'm in respectful disagreement regarding the ring-buffer approach and
think that dynamic allocation can actually be more efficient if done
properly, because there doesn't need to be head and tail pointers, which
might turn into a point of contention.

As a side note: that I've been there with imessages.  Those were first
organized as a ring-bufffer.  The major problem with that approach was
the imessages were consumed with varying delay.  In case an imessage was
left there for a longer amount of time, it blocked creation of new
imessages, because the ring-buffer cycled around once and its head
arrived back at the unconsumed imessage.

IIUC (which might not be the case) the same issue applies for snapshots.

Regards

Markus Wanner


pgsql-hackers by date:

Previous
From: Markus Wanner
Date:
Subject: Re: cheaper snapshots redux
Next
From: Rushabh Lathia
Date:
Subject: Windows env returns error while running "select pgstatindex"