diff options
author | Thomas Munro <tmunro@postgresql.org> | 2019-03-15 16:23:46 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2019-03-15 17:47:04 +1300 |
commit | bb16aba50c9492490a0b57e600a932798f45cd4f (patch) | |
tree | 36991984cfb9e141b42c4caf5f1056974526f617 /doc/src | |
parent | 13e8643bfc29d3c1455c0946281cdfc24758ffb6 (diff) | |
download | postgresql-bb16aba50c9492490a0b57e600a932798f45cd4f.tar.gz postgresql-bb16aba50c9492490a0b57e600a932798f45cd4f.zip |
Enable parallel query with SERIALIZABLE isolation.
Previously, the SERIALIZABLE isolation level prevented parallel query
from being used. Allow the two features to be used together by
sharing the leader's SERIALIZABLEXACT with parallel workers.
An extra per-SERIALIZABLEXACT LWLock is introduced to make it safe to
share, and new logic is introduced to coordinate the early release
of the SERIALIZABLEXACT required for the SXACT_FLAG_RO_SAFE
optimization, as follows:
The first backend to observe the SXACT_FLAG_RO_SAFE flag (set by
some other transaction) will 'partially release' the SERIALIZABLEXACT,
meaning that the conflicts and locks it holds are released, but the
SERIALIZABLEXACT itself will remain active because other backends
might still have a pointer to it.
Whenever any backend notices the SXACT_FLAG_RO_SAFE flag, it clears
its own MySerializableXact variable and frees local resources so that
it can skip SSI checks for the rest of the transaction. In the
special case of the leader process, it transfers the SERIALIZABLEXACT
to a new variable SavedSerializableXact, so that it can be completely
released at the end of the transaction after all workers have exited.
Remove the serializable_okay flag added to CreateParallelContext() by
commit 9da0cc35, because it's now redundant.
Author: Thomas Munro
Reviewed-by: Haribabu Kommi, Robert Haas, Masahiko Sawada, Kevin Grittner
Discussion: https://postgr.es/m/CAEepm=0gXGYhtrVDWOTHS8SQQy_=S9xo+8oCxGLWZAOoeJ=yzQ@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/monitoring.sgml | 7 | ||||
-rw-r--r-- | doc/src/sgml/parallel.sgml | 17 |
2 files changed, 6 insertions, 18 deletions
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 60b89356f70..ac2721c8ad7 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -861,7 +861,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser <tbody> <row> - <entry morerows="63"><literal>LWLock</literal></entry> + <entry morerows="64"><literal>LWLock</literal></entry> <entry><literal>ShmemIndexLock</literal></entry> <entry>Waiting to find or allocate space in shared memory.</entry> </row> @@ -1122,6 +1122,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser <entry>Waiting to add or examine predicate lock information.</entry> </row> <row> + <entry><literal>serializable_xact</literal></entry> + <entry>Waiting to perform an operation on a serializable transaction + in a parallel query.</entry> + </row> + <row> <entry><literal>parallel_query_dsa</literal></entry> <entry>Waiting for parallel query dynamic shared memory allocation lock.</entry> </row> diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml index 1005e9fef4d..b0b03c54e5f 100644 --- a/doc/src/sgml/parallel.sgml +++ b/doc/src/sgml/parallel.sgml @@ -184,13 +184,6 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; using a very large number of processes. </para> </listitem> - - <listitem> - <para> - The transaction isolation level is serializable. This is - a limitation of the current implementation. - </para> - </listitem> </itemizedlist> <para> @@ -233,16 +226,6 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%'; that may be suboptimal when run serially. </para> </listitem> - - <listitem> - <para> - The transaction isolation level is serializable. This situation - does not normally arise, because parallel query plans are not - generated when the transaction isolation level is serializable. - However, it can happen if the transaction isolation level is changed to - serializable after the plan is generated and before it is executed. - </para> - </listitem> </itemizedlist> </sect1> |