Re: Allow parallelism for deferrable serializable txns

2018-09-20 Thread Kevin Grittner
On Thu, Sep 6, 2018 at 2:14 PM Andres Freund  wrote:

> afaict for deferrable READ ONLY DEFERRABLE transactions we could
> trivially allow parallelism?  Am I missing something?

I think you are right.  What's more, DEFERRABLE transactions seem very
likely to be cases where parallelism would be especially beneficial.

Will take care of it.

-- 
Kevin Grittner
VMware vCenter Server
https://www.vmware.com/



Allow parallelism for deferrable serializable txns

2018-09-06 Thread Andres Freund
Hi,

The code currently says:

 * We can't use parallelism in serializable mode because the predicate
 * locking code is not parallel-aware.  It's not catastrophic if someone
 * tries to run a parallel plan in serializable mode; it just won't get
 * any workers and will run serially.  But it seems like a good 
heuristic
 * to assume that the same serialization level will be in effect at plan
 * time and execution time, so don't generate a parallel plan if we're 
in
 * serializable mode.
 */
if ((cursorOptions & CURSOR_OPT_PARALLEL_OK) != 0 &&
IsUnderPostmaster &&
parse->commandType == CMD_SELECT &&
!parse->hasModifyingCTE &&
max_parallel_workers_per_gather > 0 &&
!IsParallelWorker() &&
!IsolationIsSerializable())
{
/* all the cheap tests pass, so scan the query tree */
glob->maxParallelHazard = max_parallel_hazard(parse);
glob->parallelModeOK = (glob->maxParallelHazard != 
PROPARALLEL_UNSAFE);
}

afaict for deferrable READ ONLY DEFERRABLE transactions we could
trivially allow parallelism?  Am I missing something?

Greetings,

Andres Freund