On Sat, Oct 17, 2015 at 6:17 PM, Robert Haas <robertmh...@gmail.com> wrote: > It's good to have your perspective on how this can be improved, and > I'm definitely willing to write more documentation. Any lack in that > area is probably due to being too close to the subject area, having > spent several years on parallelism in general, and 200+ emails on > parallel sequential scan in particular. Your point about the lack of > a good header file comment for execParallel.c is a good one, and I'll > rectify that next week.
Here is a patch to add a hopefully-useful file header comment to execParallel.c. I included one for nodeGather.c as well, which seems to be contrary to previous practice, but actually it seems like previous practice is not the greatest: surely it's not self-evident what all of the executor nodes do. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index 3bb8206..d99e170 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -6,6 +6,14 @@ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * + * This file contains routines that are intended to support setting up, + * using, and tearing down a ParallelContext from within the PostgreSQL + * executor. The ParallelContext machinery will handle starting the + * workers and ensuring that their state generally matches that of the + * leader; see src/backend/access/transam/README.parallel for details. + * However, we must save and restore relevant executor state, such as + * any ParamListInfo associated witih the query, buffer usage info, and + * the actual plan to be passed down to the worker. * * IDENTIFICATION * src/backend/executor/execParallel.c diff --git a/src/backend/executor/nodeGather.c b/src/backend/executor/nodeGather.c index 7e2272f..017adf2 100644 --- a/src/backend/executor/nodeGather.c +++ b/src/backend/executor/nodeGather.c @@ -6,6 +6,20 @@ * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * + * A Gather executor launches parallel workers to run multiple copies of a + * plan. It can also run the plan itself, if the workers are not available + * or have not started up yet. It then merges all of the results it produces + * and the results from the workers into a single output stream. Therefore, + * it will normally be used with a plan where running multiple copies of the + * same plan does not produce duplicate output, such as PartialSeqScan. + * + * Alternatively, a Gather node can be configured to use just one worker + * and the single-copy flag can be set. In this case, the Gather node will + * run the plan in one worker and will not execute the plan itself. In + * this case, it simply returns whatever tuples were returned by the worker. + * If a worker cannot be obtained, then it will run the plan itself and + * return the results. Therefore, a plan used with a single-copy Gather + * node not be parallel-aware. * * IDENTIFICATION * src/backend/executor/nodeGather.c
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers