diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml index 5d4bb21..403c65d 100644 --- a/doc/src/sgml/parallel.sgml +++ b/doc/src/sgml/parallel.sgml @@ -284,15 +284,15 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; The driving table may be joined to one or more other tables using nested - loops or hash joins. The outer side of the join may be any kind of + loops or hash joins. The inner side of the join may be any kind of non-parallel plan that is otherwise supported by the planner provided that it is safe to run within a parallel worker. For example, it may be an index scan which looks up a value based on a column taken from the inner - table. Each worker will execute the outer side of the plan in full, which - is why merge joins are not supported here. The outer side of a merge join - will often involve sorting the entire inner table; even if it involves an - index, it is unlikely to be productive to have multiple processes each - conduct a full index scan of the inner table. + relation. Each worker will execute the inner side of the join in full, + which is why merge joins are not supported here. The inner side of a merge + join will often involve sorting the entire inner relation; even if it + involves an index, it is unlikely to be productive to have multiple + processes each conduct a full index scan of the inner side of the join. @@ -301,15 +301,17 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; It is not possible to perform the aggregation portion of a query entirely in parallel. For example, if a query involves selecting - COUNT(*), each worker could compute a total, but those totals - would need to combined in order to produce a final answer. If the query - involved a GROUP BY clause, a separate total would need to - be computed for each group. Even though aggregation can't be done entirely - in parallel, queries involving aggregation are often excellent candidates - for parallel query, because they typically read many rows but return only - a few rows to the client. Queries that return many rows to the client - are often limited by the speed at which the client can read the data, - in which case parallel query cannot help very much. + COUNT(*), each worker must compute subtotals which later must + be combined to produce an overall total in order to produce the final + answer. If the query involves a GROUP BY clause, + separate subtotals must be computed for each group seen by each parallel + worker. Each of these subtotals must then be combined into an overall + total for each group once the parallel aggregate portion of the plan is + complete. This means that queries which produce a low number of groups + relative to the number of input rows are often far more attractive to the + query planner, whereas queries which don't collect many rows into each + group are less attractive, due to the overhead of having to combine the + subtotals into totals, of which cannot run in parallel. @@ -317,11 +319,11 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; twice. First, each process participating in the parallel portion of the query performs an aggregation step, producing a partial result for each group of which that process is aware. This is reflected in the plan as - a PartialAggregate node. Second, the partial results are + a Partial Aggregate node. Second, the partial results are transferred to the leader via the Gather node. Finally, the leader re-aggregates the results across all workers in order to produce the final result. This is reflected in the plan as a - FinalizeAggregate node. + Finalize Aggregate node. @@ -330,10 +332,11 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; have a combine function. If the aggregate has a transition state of type internal, it must have serialization and deserialization functions. See for more details. - Parallel aggregation is not supported for ordered set aggregates or when - the query involves GROUPING SETS. It can only be used when - all joins involved in the query are also part of the parallel portion - of the plan. + Parallel aggregation is not supported if any aggregate function call + contains DISTINCT or ORDER BY clause and is also + not supported for ordered set aggregates or when the query involves + GROUPING SETS. It can only be used when all joins involved in + the query are also part of the parallel portion of the plan.