You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
| SET <replaceable class="parameter">configuration_parameter</replaceable> { TO <replaceable class="parameter">value</replaceable> | = <replaceable class="parameter">value</replaceable> | FROM CURRENT }
@@ -411,6 +412,43 @@ CREATE [ OR REPLACE ] FUNCTION
411
412
</listitem>
412
413
</varlistentry>
413
414
415
+
<varlistentry>
416
+
<term><literal>PARALLEL</literal></term>
417
+
418
+
<listitem>
419
+
<para><literal>PARALLEL UNSAFE</literal> indicates that the function
420
+
can't be executed in parallel mode and the presence of such a
421
+
function in an SQL statement forces a serial execution plan. This is
422
+
the default. <literal>PARALLEL RESTRICTED</literal> indicates that
423
+
the function can be executed in parallel mode, but the execution is
424
+
restricted to parallel group leader. <literal>PARALLEL SAFE</literal>
425
+
indicates that the function is safe to run in parallel mode without
426
+
restriction.
427
+
</para>
428
+
429
+
<para>
430
+
Functions should be labeled parallel unsafe if they modify any database
431
+
state, or if they make changes to the transaction such as using
432
+
sub-transactions, or if they access sequences or attempt to make
433
+
persistent changes to settings (e.g. <literal>setval</>). They should
434
+
be labeled as parallel restricted if they access temporary tables,
435
+
client connection state, cursors, prepared statements, or miscellaneous
436
+
backend-local state which the system cannot synchronize in parallel mode
437
+
(e.g. <literal>setseed</> cannot be executed other than by the group
438
+
leader because a change made by another process would not be reflected
439
+
in the leader). In general, if a function is labeled as being safe when
440
+
it is restricted or unsafe, or if it is labeled as being restricted when
441
+
it is in fact unsafe, it may throw errors or produce wrong answers
442
+
when used in a parallel query. C-language functions could in theory
443
+
exhibit totally undefined behavior if mislabeled, since there is no way
444
+
for the system to protect itself against arbitrary C code, but in most
445
+
likely cases the result will be no worse than for any other function.
446
+
If in doubt, functions should be labeled as <literal>UNSAFE</>, which is