postgresql/doc/src/sgml
Tom Lane 52f5d578d6 Create a function to reliably identify which sessions block which others.
This patch introduces "pg_blocking_pids(int) returns int[]", which returns
the PIDs of any sessions that are blocking the session with the given PID.
Historically people have obtained such information using a self-join on
the pg_locks view, but it's unreasonably tedious to do it that way with any
modicum of correctness, and the addition of parallel queries has pretty
much broken that approach altogether.  (Given some more columns in the view
than there are today, you could imagine handling parallel-query cases with
a 4-way join; but ugh.)

The new function has the following behaviors that are painful or impossible
to get right via pg_locks:

1. Correctly understands which lock modes block which other ones.

2. In soft-block situations (two processes both waiting for conflicting lock
modes), only the one that's in front in the wait queue is reported to
block the other.

3. In parallel-query cases, reports all sessions blocking any member of
the given PID's lock group, and reports a session by naming its leader
process's PID, which will be the pg_backend_pid() value visible to
clients.

The motivation for doing this right now is mostly to fix the isolation
tests.  Commit 38f8bdcac4 lobotomized
isolationtester's is-it-waiting query by removing its ability to recognize
nonconflicting lock modes, as a crude workaround for the inability to
handle soft-block situations properly.  But even without the lock mode
tests, the old query was excessively slow, particularly in
CLOBBER_CACHE_ALWAYS builds; some of our buildfarm animals fail the new
deadlock-hard test because the deadlock timeout elapses before they can
probe the waiting status of all eight sessions.  Replacing the pg_locks
self-join with use of pg_blocking_pids() is not only much more correct, but
a lot faster: I measure it at about 9X faster in a typical dev build with
Asserts, and 3X faster in CLOBBER_CACHE_ALWAYS builds.  That should provide
enough headroom for the slower CLOBBER_CACHE_ALWAYS animals to pass the
test, without having to lengthen deadlock_timeout yet more and thus slow
down the test for everyone else.
2016-02-22 14:31:43 -05:00
..
ref Improve documentation about CREATE INDEX CONCURRENTLY. 2016-02-16 13:43:25 -05:00
.gitignore Don't generate plain-text HISTORY and src/test/regress/README anymore. 2014-02-10 20:48:04 -05:00
acronyms.sgml Add SP-GiST (space-partitioned GiST) index access method. 2011-12-17 16:42:30 -05:00
adminpack.sgml Add xreflabels to /contrib manuals so links appear correct. Also update 2011-05-07 22:29:20 -04:00
advanced.sgml doc: split long query into multiple lines 2013-12-04 10:03:13 -05:00
arch-dev.sgml doc: Fix claim that query is passed as ASCII text 2013-05-30 21:09:27 -04:00
array.sgml Allow omitting one or both boundaries in an array slice specifier. 2015-12-22 21:05:29 -05:00
auth-delay.sgml doc: Fix DocBook XML validity 2014-05-06 21:28:58 -04:00
auto-explain.sgml Fix failure of contrib/auto_explain to print per-node timing information. 2014-09-19 13:19:27 -04:00
backup.sgml doc: Spell checking 2015-09-10 21:35:06 -04:00
bgworker.sgml Fix spi_worker mention in bgworker documentation 2016-01-28 14:08:21 +01:00
biblio.sgml Properly capitalize hyphenated words in documentation titles. 2011-02-01 17:00:26 -05:00
bki.sgml Allow forcing nullness of columns during bootstrap. 2015-02-21 22:31:54 +01:00
brin.sgml Document brin_summarize_new_pages 2015-12-28 15:28:19 -03:00
btree-gin.sgml docs: consistently uppercase index method and add spacing 2015-05-15 11:42:34 -04:00
btree-gist.sgml docs: consistently uppercase index method and add spacing 2015-05-15 11:42:34 -04:00
catalogs.sgml Create a function to reliably identify which sessions block which others. 2016-02-22 14:31:43 -05:00
charset.sgml Docs: fix erroneous claim about max byte length of GB18030. 2015-05-14 14:59:00 -04:00
chkpass.sgml Add xreflabels to /contrib manuals so links appear correct. Also update 2011-05-07 22:29:20 -04:00
citext.sgml citext's regexp_matches() functions weren't documented, either. 2015-05-05 16:11:01 -04:00
client-auth.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
config.sgml Allow the WAL writer to flush WAL at a reduced rate. 2016-02-16 00:56:34 +01:00
contacts.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
contrib-spi.sgml Add xreflabels to /contrib manuals so links appear correct. Also update 2011-05-07 22:29:20 -04:00
contrib.sgml Remove *pgaudit* references also. 2015-05-28 13:02:09 -04:00
cube.sgml Minor hacking on contrib/cube documentation. 2015-12-29 21:21:04 -05:00
custom-scan.sgml Allow parallel custom and foreign scans. 2016-02-03 12:49:46 -05:00
datatype.sgml Extend sortsupport for text to more opclasses. 2016-02-03 14:29:53 -05:00
datetime.sgml Support timezone abbreviations that sometimes change. 2014-10-16 15:22:10 -04:00
dblink.sgml dblink docs: fix typo to use "connname" (3 n's), not "conname" 2015-08-27 13:43:10 -04:00
ddl.sgml Improve documentation about PRIMARY KEY constraints. 2016-02-07 16:02:44 -05:00
dfunc.sgml doc: Reflect renaming of Mac OS X to OS X 2014-09-09 13:56:29 -04:00
dict-int.sgml Add xreflabels to /contrib manuals so links appear correct. Also update 2011-05-07 22:29:20 -04:00
dict-xsyn.sgml Add xreflabels to /contrib manuals so links appear correct. Also update 2011-05-07 22:29:20 -04:00
diskusage.sgml Get rid of pg_class.reltoastidxid. 2013-07-04 03:24:09 +09:00
dml.sgml Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
docguide.sgml Document how to build the docs using the website style. 2015-07-29 11:18:32 -04:00
earthdistance.sgml Doc: update external URLs for PostGIS project. 2015-12-12 20:02:09 -05:00
ecpg.sgml docs: HTML-escape '>' in '=>' using HTML entities 2015-08-05 23:03:45 -04:00
errcodes.sgml Provide database object names as separate fields in error messages. 2013-01-29 17:08:26 -05:00
event-trigger.sgml Mention table_rewrite as valid event trigger tag 2015-07-15 17:10:54 +03:00
extend.sgml Fix pg_dump handling of extension config tables 2015-03-02 14:12:21 -05:00
external-projects.sgml doc: Remove redundant duplicate URLs from ulink elements 2015-12-31 22:26:57 -05:00
fdwhandler.sgml Add an explicit representation of the output targetlist to Paths. 2016-02-18 20:02:03 -05:00
features.sgml Update SQL features/conformance information to SQL:2011 2012-05-17 09:50:04 +03:00
file-fdw.sgml Provide a FORCE NULL option to COPY in CSV mode. 2014-03-04 17:31:59 -05:00
filelist.sgml First draft of 9.5 release notes 2015-06-11 00:09:32 -04:00
fixrtf Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
func.sgml Create a function to reliably identify which sessions block which others. 2016-02-22 14:31:43 -05:00
fuzzystrmatch.sgml Improve levenshtein() docs. 2016-01-22 12:29:07 -05:00
generate-errcodes-table.pl Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo.sgml doc: Improve setup for documentation building with FOP 2013-10-21 06:43:08 -04:00
gin.sgml Add gin_clean_pending_list function to clean up GIN pending list 2016-01-28 12:57:52 +09:00
gist.sgml Fix assorted inconsistencies in GiST opclass support function declarations. 2016-01-19 12:04:36 -05:00
high-availability.sgml Document that max_worker_processes must be high enough in standby. 2015-09-03 22:30:16 +09:00
history.sgml Add small doc mention that libpq is named after POSTQUEL. 2012-09-02 08:42:03 -04:00
hstore.sgml Add hstore_to_jsonb() and hstore_to_jsonb_loose() to hstore documentation. 2016-02-03 12:57:13 -05:00
indexam.sgml Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
indices.sgml doc: Spell checking 2015-09-10 21:35:06 -04:00
info.sgml Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
information_schema.sgml Add transforms feature 2015-04-26 10:33:14 -04:00
install-windows.sgml Update docs for vcregress.pl bincheck changes 2015-11-18 23:32:16 -05:00
installation.sgml doc: Fix stand-alone INSTALL file build 2016-02-03 12:32:35 -05:00
intagg.sgml Add contrib function references in the doc index 2013-07-04 11:33:11 -04:00
intarray.sgml Add contrib function references in the doc index 2013-07-04 11:33:11 -04:00
intro.sgml Support automatically-updatable views. 2012-12-08 18:26:21 -05:00
isn.sgml Update URL reference material in /contrib/isn docs 2014-09-03 17:22:20 -04:00
jadetex.cfg Improve our workaround for 'TeX capacity exceeded' in building PDF files. 2015-11-10 15:59:59 -05:00
json.sgml Docs: add example clarifying use of nested JSON containment. 2015-10-29 18:55:02 -04:00
keywords.sgml Update key words table for 9.5 2015-08-14 12:11:05 -04:00
legal.sgml Update copyright for 2016 2016-01-02 13:33:40 -05:00
libpq.sgml Document use of Subject Alternative Names in SSL server certificates. 2015-12-15 16:57:23 -05:00
lo.sgml Add more limited large object trigger example. 2012-08-14 23:25:20 -04:00
lobj.sgml Update copyright for 2016 2016-01-02 13:33:40 -05:00
logicaldecoding.sgml Fix syntax descriptions for replication commands in logicaldecoding.sgml 2016-01-29 12:14:56 +09:00
ltree.sgml docs: consistently uppercase index method and add spacing 2015-05-15 11:42:34 -04:00
maintenance.sgml Improve documentation around autovacuum-related storage parameters. 2015-11-11 17:13:38 -05:00
Makefile doc: Call xmllint for validity also in the fop build 2015-06-10 19:54:28 -04:00
manage-ag.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
mk_feature_tables.pl Run newly-configured perltidy script on Perl files. 2012-07-04 21:47:49 -04:00
monitoring.sgml pgstat: add WAL receiver status view & SRF 2016-01-07 16:21:19 -03:00
mvcc.sgml Add RMV to list of commands taking AE lock. 2015-11-02 06:23:10 -06:00
nls.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
notation.sgml doc: Remove paragraph about typesetting conventions 2013-05-31 22:45:03 -04:00
oid2name.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
pageinspect.sgml Improve pageinspect module 2015-11-25 16:31:55 +03:00
passwordcheck.sgml Remove support for native krb5 authentication 2014-01-19 17:05:01 +01:00
perform.sgml Allow foreign tables to participate in inheritance. 2015-03-22 13:53:21 -04:00
pgbuffercache.sgml Add pinning_backends column to the pg_buffercache extension. 2014-08-22 00:28:37 +02:00
pgcrypto.sgml pgcrypto: Report errant decryption as "Wrong key or corrupt data". 2015-05-18 10:02:31 -04:00
pgfreespacemap.sgml doc: Fix DocBook XML validity 2014-05-06 21:28:58 -04:00
pgprewarm.sgml Small grammar fix 2015-08-31 14:07:17 +02:00
pgrowlocks.sgml docs: remove unnecessary references to old PG versions 2014-02-24 12:56:37 -05:00
pgstandby.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
pgstatstatements.sgml Docs: explain contrib/pg_stat_statements' handling of GC failure. 2015-10-05 12:44:12 -04:00
pgstattuple.sgml Fix multiple bugs in contrib/pgstattuple's pgstatindex() function. 2016-02-18 15:40:35 -05:00
pgtrgm.sgml docs: consistently uppercase index method and add spacing 2015-05-15 11:42:34 -04:00
planstats.sgml Improve wording in the planner doc 2016-02-16 15:49:00 +09:00
plhandler.sgml Document security implications of check_function_bodies. 2014-02-17 09:33:31 -05:00
plperl.sgml doc: Fix DocBook XML validity 2014-05-06 21:28:58 -04:00
plpgsql.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
plpython.sgml Document that PL/Python now returns floats using repr() not str(). 2015-09-01 19:25:58 -04:00
pltcl.sgml doc: Various typo/grammar fixes 2014-08-30 10:52:36 -05:00
postgres-fdw.sgml postgres_fdw: Push down joins to remote servers. 2016-02-09 14:00:50 -05:00
postgres.sgml Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
problems.sgml Use "backend process" rather than "backend server", where appropriate. 2011-03-12 09:38:56 -05:00
protocol.sgml Fix typo 2016-02-15 11:41:34 +01:00
queries.sgml doc: Fix commas and improve spacing 2015-11-16 19:02:38 -05:00
query.sgml Use "backend process" rather than "backend server", where appropriate. 2011-03-12 09:38:56 -05:00
rangetypes.sgml docs: Map operator @> to the proper SGML escape for '>' 2015-10-07 09:42:26 -04:00
README.links docs: improve xref description for xreflabel and refentry links 2014-01-30 12:26:18 -05:00
recovery-config.sgml doc: Spell checking 2015-09-10 21:35:06 -04:00
reference.sgml Add transforms feature 2015-04-26 10:33:14 -04:00
regress.sgml Lock down regression testing temporary clusters on Windows. 2014-12-17 22:48:40 -05:00
release-7.4.sgml doc: Various typo/grammar fixes 2014-08-30 10:52:36 -05:00
release-8.0.sgml Improve cross-references between minor version release notes. 2014-02-12 19:09:18 -05:00
release-8.1.sgml Improve cross-references between minor version release notes. 2014-02-12 19:09:18 -05:00
release-8.2.sgml doc: Various typo/grammar fixes 2014-08-30 10:52:36 -05:00
release-8.3.sgml Fix recovery_command -> restore_command typo in 8.3 release notes. 2015-02-24 14:41:54 +02:00
release-8.4.sgml Doc: update external URLs for PostGIS project. 2015-12-12 20:02:09 -05:00
release-9.0.sgml Adjust back-branch release note description of commits a2a718b22 et al. 2016-01-02 15:29:02 -05:00
release-9.1.sgml Last-minute updates for release notes. 2016-02-08 10:49:37 -05:00
release-9.2.sgml Last-minute updates for release notes. 2016-02-08 10:49:37 -05:00
release-9.3.sgml Last-minute updates for release notes. 2016-02-08 10:49:37 -05:00
release-9.4.sgml Last-minute updates for release notes. 2016-02-08 10:49:37 -05:00
release-9.5.sgml release notes: fix 9.5 SGML comment about commit 2016-02-16 12:43:00 -05:00
release-old.sgml doc: Various typo/grammar fixes 2014-08-30 10:52:36 -05:00
release.sgml First draft of 9.5 release notes 2015-06-11 00:09:32 -04:00
replication-origins.sgml Do some copy-editing on the docs for replication origins. 2016-01-03 16:03:42 -05:00
rowtypes.sgml Further review of range-types patch. 2011-11-18 18:24:32 -05:00
rules.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
runtime.sgml Correct the formulas for System V IPC parameters SEMMNI and SEMMNS in docs. 2016-02-16 14:49:47 +09:00
seg.sgml docs: HTML-escape '>' in '=>' using HTML entities 2015-08-05 23:03:45 -04:00
sepgsql.sgml Correct sepgsql docs with regard to RLS 2015-11-13 11:06:38 -05:00
sourcerepo.sgml Properly capitalize documentation headings; some only had initial-word 2011-01-29 13:01:48 -05:00
sources.sgml Add some notes about coding conventions do the docs. 2015-09-22 11:13:28 +02:00
spgist.sgml Add an in-core GiST index opclass for inet/cidr types. 2014-04-08 15:46:43 -04:00
spi.sgml doc: Spell checking 2014-07-16 22:48:11 -04:00
sql.sgml Implement SKIP LOCKED for row-level locks 2014-10-07 17:23:34 -03:00
sslinfo.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
standalone-install.sgml Don't generate plain-text HISTORY and src/test/regress/README anymore. 2014-02-10 20:48:04 -05:00
start.sgml Fix wording in the Tutorial document. 2016-02-21 09:04:59 +09:00
storage.sgml Fix mention of htup.h in storage.sgml 2015-10-01 23:00:52 +09:00
stylesheet-common.xsl doc: Disable preface.autolabel in XSLT 2013-12-01 17:13:23 -05:00
stylesheet-fo.xsl doc: Fix PDF build with FOP 2015-06-03 20:19:47 -04:00
stylesheet-hh.xsl Fix display of <command> elements on man pages 2012-04-30 21:18:03 +03:00
stylesheet-man.xsl doc: Work around stylesheet bug for man build 2014-08-17 09:10:28 -04:00
stylesheet.css doc: Improve CSS style of option element 2016-02-19 23:01:54 -05:00
stylesheet.dsl doc: Move website-stylesheet setting to a more appropriate location 2014-12-11 21:48:01 -05:00
stylesheet.xsl doc: Disable indentation of XHTML output 2014-02-05 23:49:25 -05:00
syntax.sgml doc: Whitespace and formatting fixes 2015-08-20 22:47:08 -04:00
tablefunc.sgml Add contrib function references in the doc index 2013-07-04 11:33:11 -04:00
tablesample-method.sgml Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
tcn.sgml Reduce messages about implicit indexes and sequences to DEBUG1. 2012-07-04 20:35:29 -04:00
test-decoding.sgml doc: Fix spacing in verbatim environments 2014-07-08 11:39:36 -04:00
textsearch.sgml docs: update guidelines on when to use GIN and GiST indexes 2015-10-05 13:38:36 -04:00
trigger.sgml Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
tsearch2.sgml Add xreflabels to /contrib manuals so links appear correct. Also update 2011-05-07 22:29:20 -04:00
tsm-system-rows.sgml Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
tsm-system-time.sgml Redesign tablesample method API, and do extensive code review. 2015-07-25 14:39:00 -04:00
typeconv.sgml Use standard casting mechanism to convert types in plpgsql, when possible. 2015-03-04 11:04:30 -05:00
unaccent.sgml Allow multi-character source strings in contrib/unaccent. 2014-06-30 21:46:29 -04:00
user-manag.sgml Further improve documentation of the role-dropping process. 2015-12-04 14:44:13 -05:00
uuid-ossp.sgml doc: Reflect renaming of Mac OS X to OS X 2014-09-09 13:56:29 -04:00
vacuumlo.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
wal.sgml Also trigger restartpoints based on max_wal_size on standby. 2015-06-29 00:09:10 +03:00
xaggr.sgml Support arrays as input to array_agg() and ARRAY(SELECT ...). 2014-11-25 12:21:28 -05:00
xfunc.sgml Change the way that LWLocks for extensions are allocated. 2016-02-04 16:43:04 -05:00
xindex.sgml Restructure index access method API to hide most of it at the C level. 2016-01-17 19:36:59 -05:00
xml2.sgml doc: Various typo/grammar fixes 2014-08-30 10:52:36 -05:00
xoper.sgml doc: Various typo/grammar fixes 2014-08-30 10:52:36 -05:00
xplang.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
xtypes.sgml Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00

<!-- doc/src/sgml/README.links -->

Linking within SGML documents can be confusing, so here is a summary:


Intra-document Linking
----------------------

<xref>
	use to get chapter/section number from the title of the target
	link, or xreflabel if defined at the target, or refentrytitle if target
        is a refentry;  has no close tag
	http://www.oasis-open.org/docbook/documentation/reference/html/xref.html

<link>
	use to supply text for the link, requires </link>
	http://www.oasis-open.org/docbook/documentation/reference/html/link.html

linkend=
	controls the target of the link/xref, required

endterm=
	for <xref>, allows the text of the link/xref to be taken from a
	different link target title


External Linking
----------------

<ulink>
	like <link>, but uses a URL (not a document target);  requires
	</ulink>; if no text is specified, the URL appears as the link
	text
	http://www.oasis-open.org/docbook/documentation/reference/html/ulink.html

url=
	used by <ulink> to specify the URL, required


Guidelines
----------

o  If you want to supply text, use <link>, else <xref>
o  Do not use text with <ulink> so the URL appears in printed output
o  Specific nouns like GUC variables, SQL commands, and contrib modules
   usually have xreflabels