Gather Mergenode, but can occur elsewhere in a plan which contains such a node. A parallel unsafe operation is one which cannot be performed while parallel query is in use, not even in the leader. When a query contains anything which is parallel unsafe, parallel query is completely disabled for that query.
IsForeignScanParallelSafeAPI which indicates otherwise.
PARALLEL RESTRICTED, or
PARALLEL UNSAFEas appropriate. When using CREATE AGGREGATE, the
PARALLELoption can be specified with
UNSAFEas the corresponding value.
PARALLEL UNSAFEif they write to the database, access sequences, change the transaction state even temporarily (e.g. a PL/pgSQL function which establishes an
EXCEPTIONblock to catch errors), or make persistent changes to settings. Similarly, functions must be marked
PARALLEL RESTRICTEDif they access temporary tables, client connection state, cursors, prepared statements, or miscellaneous backend-local state which the system cannot synchronize across workers. For example,
randomare parallel restricted for this last reason.
PARALLEL RESTRICTEDto ensure that they execute only in the leader.
WHEREclause applied to a particular table is parallel restricted, the query planner will not consider performing a scan of that table in the parallel portion of a plan. In some cases, it would be possible (and perhaps even efficient) to include the scan of that table in the parallel portion of the query and defer the evaluation of the
WHEREclause so that it happens above the
Gathernode. However, the planner does not do this.\