Re: things I learned from working on memory allocation - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: things I learned from working on memory allocation
Date
Msg-id CAA4eK1JGfYUe55r0uT9MXrjFskhoOUjxMMHDGBe0tJE471rm5Q@mail.gmail.com
Whole thread Raw
In response to Re: things I learned from working on memory allocation  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, Jul 11, 2014 at 11:15 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, Jul 10, 2014 at 1:05 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> > If there is an noticeable impact, then do you think having separate
> > file/infrastructure for parallel sort can help, basically non-parallel
> > and parallel sort will have some common and some specific parts.
> > The above layer will call the parallel/non-parallel functions based on
> > operation need.
>
> The tuplesort.c already handles so many cases already that adding yet
> another axis of variability is intimidating.  But it may work out that
> there's no better option.

For using new allocator, one idea is that it works seemlesly with current
memory allocation routines (palloc, pfree, repalloc, ..), another could be
that have separate routines (shm_palloc, shm_pfree, ..) for allocation
from new allocator.  I think having separate routines means all the call
sites for allocation/deallocation needs to be aware of operation type
(parallel or non-parallel), however I think this can avoid the overhead
for non-parallel cases.

I think it is bit difficult to say which approach ("with allocator" or
"directly use dsm") will turn out to be better as both have its pros and
cons as listed by you, however I feel that if we "directly using dsm", we
might need to change more core logic than "with allocator".

I believe we will face the same question again if somebody wants to
parallelize the join, so one parameter to decide could be based on
which approach will lead to less change in core logic/design.
 

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Crash on backend exit w/ OpenLDAP [2.4.24, 2.4.31]
Next
From: Amit Kapila
Date:
Subject: Re: better atomics - v0.5