diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/config.sgml | 13 | ||||
-rw-r--r-- | doc/src/sgml/high-availability.sgml | 34 |
2 files changed, 30 insertions, 17 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index c84529f267f..f9c13e7c491 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.272 2010/04/29 21:36:18 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.273 2010/05/02 02:10:32 tgl Exp $ --> <chapter Id="runtime-config"> <title>Server Configuration</title> @@ -1947,13 +1947,12 @@ SET ENABLE_SEQSCAN TO OFF; <para> When Hot Standby is active, this parameter specifies a wait policy for applying WAL entries that conflict with active queries. - If a conflict should occur the server will delay up to this number - of seconds before it cancels conflicting queries, as + If a conflict should occur the server will delay up to this long + before it cancels conflicting queries, as described in <xref linkend="hot-standby-conflict">. - Typically, this parameter is used only during replication. - The value is specified in seconds, and -1 causes the standby to wait - forever for a conflicting query to complete. The default is 30 seconds. + A value of -1 causes the standby to wait forever for a conflicting + query to complete. This parameter can only be set in the <filename>postgresql.conf</> file or on the server command line. </para> @@ -1964,7 +1963,7 @@ SET ENABLE_SEQSCAN TO OFF; </para> <para> While it is tempting to believe that <varname>max_standby_delay</> - is the maximum number of seconds a query can run before + is the maximum length of time a query can run before cancellation is possible, this is not true. When a long-running query ends, there is a finite time required to apply backlogged WAL logs. If a second long-running query appears before the diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index b2f1a583fc3..ef4c1bb2c21 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/high-availability.sgml,v 1.65 2010/04/29 21:36:18 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/high-availability.sgml,v 1.66 2010/05/02 02:10:32 tgl Exp $ --> <chapter id="high-availability"> <title>High Availability, Load Balancing, and Replication</title> @@ -1480,7 +1480,8 @@ if (!triggered) There are a number of choices for resolving query conflicts. The default is to wait and hope the query finishes. The server will wait automatically until the lag between primary and standby is at most - <varname>max_standby_delay</> seconds. Once that grace period expires, + <xref linkend="guc-max-standby-delay"> (30 seconds by default). + Once that grace period expires, one of the following actions is taken: <itemizedlist> @@ -1514,15 +1515,28 @@ if (!triggered) </para> <para> - <varname>max_standby_delay</> is set in <filename>postgresql.conf</>. - The parameter applies to the server as a whole, so if the delay is consumed - by a single query then there may be little or no waiting for queries that - follow, though they will have benefited equally from the initial - waiting period. The server may take time to catch up again before the grace - period is available again, though if there is a heavy and constant stream - of conflicts it may seldom catch up fully. + Keep in mind that <varname>max_standby_delay</> is compared to the + difference between the standby server's clock and the transaction + commit timestamps read from the WAL log. Thus, the grace period + allowed to any one query on the standby is never more than + <varname>max_standby_delay</>, and could be considerably less if the + standby has already fallen behind as a result of waiting for previous + queries to complete, or as a result of being unable to keep up with a + heavy update load. </para> + <caution> + <para> + Be sure that the primary and standby servers' clocks are kept in sync; + otherwise the values compared to <varname>max_standby_delay</> will be + erroneous, possibly leading to undesirable query cancellations. + If the clocks are intentionally not in sync, or if there is a large + propagation delay from primary to standby, it is advisable to set + <varname>max_standby_delay</> to -1. In any case the value should be + larger than the largest expected clock skew between primary and standby. + </para> + </caution> + <para> Users should be clear that tables that are regularly and heavily updated on the primary server will quickly cause cancellation of longer running queries on @@ -1656,7 +1670,7 @@ LOG: database system is ready to accept read only connections <varname>max_standby_delay</> or even set it to zero, though that is a very aggressive setting. If the standby server is tasked as an additional server for decision support queries then it might be acceptable to set this - to a value of many hours (in seconds). It is also possible to set + to a value of many hours. It is also possible to set <varname>max_standby_delay</> to -1 which means wait forever for queries to complete; this will be useful when performing an archive recovery from a backup. |