On Fri, Jul 11, 2014 at 11:15 PM, Robert Haas <robertmh...@gmail.com> wrote: > On Thu, Jul 10, 2014 at 1:05 AM, Amit Kapila <amit.kapil...@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