Re: [HACKERS] Parallel tuplesort (for parallel B-Tree index creation)
Amit Kapila <amit.kapila16@gmail.com>
On Fri, Jan 26, 2018 at 12:36 PM, Amit Kapila <amit.kapila16@gmail.com> wrote: > On Fri, Jan 26, 2018 at 12:00 PM, Peter Geoghegan <pg@bowt.ie> wrote: >> On Thu, Jan 25, 2018 at 10:00 PM, Amit Kapila <amit.kapila16@gmail.com> wrote: >>>> At this point, my preferred solution is for someone to go implement >>>> Amit's WaitForParallelWorkersToAttach() idea [1] (Amit himself seems >>>> like the logical person for the job). >>>> >>> >>> I can implement it and share a prototype patch with you which you can >>> use to test parallel sort stuff. >> >> That would be great. Thank you. >> >>> I would like to highlight the >>> difference which you will see with WaitForParallelWorkersToAttach as >>> compare to WaitForParallelWorkersToFinish() is that the former will >>> give you how many of nworkers_launched workers are actually launched >>> whereas latter gives an error if any of the expected workers is not >>> launched. I feel former is good and your proposed way of calling it >>> after the leader is done with its work has alleviated the minor >>> disadvantage of this API which is that we need for workers to startup. >> >> I'm not sure that it makes much difference, though, since in the end >> WaitForParallelWorkersToFinish() is called anyway, much like >> nodeGather.c. Have I missed something? >> > > Nopes, you are right. I had in my mind that if we have something like > what I am proposing, then we don't even need to detect failures in > WaitForParallelWorkersToFinish and we can finish the work without > failing. > >> I had imagined that WaitForParallelWorkersToAttach() would give me an >> error in the style of WaitForParallelWorkersToFinish(), without >> actually waiting for the parallel workers to finish. >> > > I think that is also doable. I will give it a try and report back if > I see any problem with it. > I have posted the patch for the above API and posted it on a new thread [1]. Do let me know either here or on that thread if the patch suffices your need? [1] - https://www.postgresql.org/message-id/CAA4eK1%2Be2MzyouF5bg%3DOtyhDSX%2B%3DAo%3D3htN%3DT-r_6s3gCtKFiw%40mail.gmail.com -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
Commits
-
Support parallel btree index builds.
- 9da0cc35284b 11.0 landed
-
Report an ERROR if a parallel worker fails to start properly.
- 2badb5afb89c 11.0 cited
-
Transfer state pertaining to pending REINDEX operations to workers.
- 29d58fd3adae 11.0 landed
-
Add a barrier primitive for synchronizing backends.
- 1145acc70deb 11.0 cited
-
Allow DML commands that create tables to use parallel query.
- e9baa5e9fa14 11.0 cited
-
Refactor GetOldestXmin() to use flags
- af4b1a0869bd 10.0 cited
-
Fix regression in parallel planning against inheritance tables.
- 2609e91fcf9d 10.0 cited
-
Don't create "holes" in BufFiles, in the new logtape code.
- 7ac4a389a7db 10.0 cited
-
Simplify the code for logical tape read buffers.
- b75f467b6eec 10.0 cited
-
Fix excessive memory consumption in the new sort pre-reading code.
- b56fb691b003 10.0 cited
-
Implement binary heap replace-top operation in a smarter way.
- 24598337c8d2 10.0 cited
-
Cosmetic code cleanup in commands/extension.c.
- 25794e841e5b 10.0 cited
-
Speed up planner's scanning for parallel-query hazards.
- da1c91631e35 10.0 cited
-
Read from the same worker repeatedly until it returns no tuple.
- bc7fcab5e36b 9.6.0 cited
-
Improve tuplesort.c to support variable merge order. The original coding
- df700e6b4019 8.2.0 cited