summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-04-10 10:26:54 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-04-10 10:26:54 -0400
commit511540dadf1166d80b864f63979178f324844060 (patch)
treeb020d15352b84a5482c5b5064d6cd84793b1bdb8 /doc/src
parent9cf5c31964315181e475fc37a5e9ad2204fe3484 (diff)
Move isolationtester's is-blocked query into C code for speed.
Commit 4deb41381 modified isolationtester's query to see whether a session is blocked to also check for waits occurring in GetSafeSnapshot. However, it did that in a way that enormously increased the query's runtime under CLOBBER_CACHE_ALWAYS, causing the buildfarm members that use that to run about four times slower than before, and in some cases fail entirely. To fix, push the entire logic into a dedicated backend function. This should actually reduce the CLOBBER_CACHE_ALWAYS runtime from what it was previously, though I've not checked that. In passing, expose a SQL function to check for safe-snapshot blockage, comparable to pg_blocking_pids. This is more or less free given the infrastructure built to solve the other problem, so we might as well. Thomas Munro Discussion: https://postgr.es/m/20170407165749.pstcakbc637opkax@alap3.anarazel.de
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml27
1 files changed, 26 insertions, 1 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index cb0a36a170f..6d7c7b8e0d0 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -15747,7 +15747,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
<row>
<entry><literal><function>pg_blocking_pids(<type>int</type>)</function></literal></entry>
<entry><type>int[]</type></entry>
- <entry>Process ID(s) that are blocking specified server process ID</entry>
+ <entry>Process ID(s) that are blocking specified server process ID from acquiring a lock</entry>
</row>
<row>
@@ -15794,6 +15794,12 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
</row>
<row>
+ <entry><literal><function>pg_safe_snapshot_blocking_pids(<type>int</type>)</function></literal></entry>
+ <entry><type>int[]</type></entry>
+ <entry>Process ID(s) that are blocking specified server process ID from acquiring a safe snapshot</entry>
+ </row>
+
+ <row>
<entry><literal><function>pg_trigger_depth()</function></literal></entry>
<entry><type>int</type></entry>
<entry>current nesting level of <productname>PostgreSQL</> triggers
@@ -16068,6 +16074,25 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
</para>
<indexterm>
+ <primary>pg_safe_snapshot_blocking_pids</primary>
+ </indexterm>
+
+ <para>
+ <function>pg_safe_snapshot_blocking_pids</function> returns an array of
+ the process IDs of the sessions that are blocking the server process with
+ the specified process ID from acquiring a safe snapshot, or an empty array
+ if there is no such server process or it is not blocked. A session
+ running a <literal>SERIALIZABLE</literal> transaction blocks
+ a <literal>SERIALIZABLE READ ONLY DEFERRABLE</literal> transaction from
+ acquiring a snapshot until the latter determines that it is safe to avoid
+ taking any predicate locks. See <xref linkend="xact-serializable"> for
+ more information about serializable and deferrable transactions. Frequent
+ calls to this function could have some impact on database performance,
+ because it needs access to the predicate lock manager's shared
+ state for a short time.
+ </para>
+
+ <indexterm>
<primary>version</primary>
</indexterm>