Re: Threaded Sorting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Copeland <greg(at)CopelandConsulting(dot)Net>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>, PostgresSQL Hackers Mailing List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Threaded Sorting
Date: 2002-10-04 20:07:12
Message-ID: 26334.1033762032@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Copeland <greg(at)CopelandConsulting(dot)Net> writes:
> ... I can understand why
> addressing the seemingly more common I/O bound case would receive
> priority, however, I'm at a loss as to why the other would be completely
> ignored.

Bruce already explained that we avoid threads because of portability and
robustness considerations.

The notion of a sort process pool seems possibly attractive. I'm
unconvinced that it's going to be a win though because of the cost of
shoving data across address-space boundaries. Another issue is that
the sort comparison function can be anything, including user-defined
code that does database accesses or other interesting stuff. This
would mean that the sort auxiliary process would have to adopt the
database user identity of the originating process, and quite possibly
absorb a whole lot of other context information before it could
correctly/safely execute the comparison function. That pushes the
overhead up a lot more.

(The need to allow arbitrary operations in the comparison function would
put a pretty substantial crimp on a thread-based approach, too, even if
we were willing to ignore the portability issue.)

Still, if you want to try it out, feel free ... this is an open-source
project, and if you can't convince other people that an idea is worth
implementing, that doesn't mean you can't implement it yourself and
prove 'em wrong.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Copeland 2002-10-04 20:43:37 Re: Threaded Sorting
Previous Message Tom Lane 2002-10-04 19:51:36 Re: Threaded Sorting