Tom Lane wrote:
>
> In trying to understand what the code is doing, I am confused by the
> buffer refcount save/restore mechanism. Why does the executor want
> to save/restore buffer refcounts? I can sort of see that that might
...
> If anyone understands why this mechanism is designed this way,
> please tell me about it.
This bothered me for long time too.
The only explanation I see in execMain.c:
/** reset buffer refcount. the current refcounts are saved and will be* restored when ExecutorEnd is called** this
makessure that when ExecutorRun's are called recursively as for* postquel functions, the buffers pinned by one
ExecutorRunwill not* be unpinned by another ExecutorRun.*/
But buffers pinned by one Executor invocation SHOULDN'T
be unpinned by another one (if there are no bugs in code,
but this is another story).
So, try to remove this save/restore mechanism and let's see...
Vadim