Back out patch:
authorBruce Momjian <[email protected]>
Sat, 4 Jun 2005 22:57:22 +0000 (22:57 +0000)
committerBruce Momjian <[email protected]>
Sat, 4 Jun 2005 22:57:22 +0000 (22:57 +0000)
---------------------------------------------------------------------------

Tom Lane <[email protected]> writes:
> a_ogawa <[email protected]> writes:
> > It is a reasonable idea. However, the majority part of MemSet was not
> > able to be avoided by this idea. Because the per-tuple contexts are used
> > at the early stage of executor.
>
> Drat.  Well, what about changing that?  We could introduce additional
> contexts or change the startup behavior so that the ones that are
> frequently reset don't have any data in them unless you are working
> with pass-by-ref values inside the inner loop.

That might be possible. However, I think that we should change only
aset.c about this article.
I thought further: We can check whether context was used from the last
reset even when blocks list is not empty. Please see attached patch.

src/backend/utils/mmgr/aset.c

index dfe93b187d1072d3aa445fbc8a423ec7776efb79..afbb57af68c1f37048552432ecca9a665fe5a983 100644 (file)
@@ -399,17 +399,6 @@ AllocSetReset(MemoryContext context)
        if (block == NULL)
                return;
 
-       /*
-        * When blocks list has only "keeper" block and freeptr of the block
-        * is initial value, the context is not used from last reset.
-        */
-       if (block == set->keeper && block->next == NULL)
-       {
-               char       *datastart = ((char *) block) + ALLOC_BLOCKHDRSZ;
-               if (block->freeptr == datastart)
-                       return;
-       }
-
        /* Clear chunk freelists */
        MemSetAligned(set->freelist, 0, sizeof(set->freelist));