@@ -83,7 +83,7 @@ DROP EXTENSION aqo;
8383 <listitem>
8484 <para>
8585 <literal>forced</literal> —
86- this mode tries to optimize all queries together, regardless of
86+ this mode tries to optimize all new queries together, regardless of
8787 the query type.
8888 </para>
8989 </listitem>
@@ -148,11 +148,8 @@ where <replaceable>mode</> is the name of the optimization mode to use.
148148 mode. However, since the <literal>forced</literal> mode lacks
149149 intelligent tuning, performance may decrease for some queries.
150150 If you see performance issues in this mode, switch <filename>aqo</filename> to the
151- <literal>controlled</literal> mode:
151+ <literal>controlled</literal> mode.
152152 </para>
153- <programlisting>
154- SET aqo.mode = 'controlled';
155- </programlisting>
156153 <para>
157154 In the <literal>controlled</literal> mode, <filename>aqo</filename> does not collect statistics for new
158155 query types, so they will not be optimized. For known query
@@ -298,6 +295,57 @@ UPDATE aqo_queries SET learn_aqo=false WHERE query_hash = '<replaceable>hash</>'
298295UPDATE aqo_queries SET use_aqo=false, learn_aqo=false, auto_tuning=false;
299296</programlisting>
300297 </sect3>
298+ <sect3 id="using-aqo-on-standby">
299+ <title>Using aqo on Standby</title>
300+ <para>
301+ In master-standby configurations, <filename>aqo</filename>
302+ statistics on standby is inherited from master in read-only mode.
303+ Standby queries do not update <filename>aqo</filename> statistics,
304+ regardless of the current <filename>aqo</filename> settings.
305+ If you would like to update the statistics on
306+ standby for one or more query types, you must run these queries
307+ on master and synchronize the standby.
308+ </para>
309+ <para>
310+ You can define whether to use <filename>aqo</filename> statistics
311+ for standby queries independent of the master configuration,
312+ toggling <filename>aqo</filename> modes as required. By default,
313+ <filename>aqo</filename> optimizes queries on standby as follows:
314+ <itemizedlist>
315+ <listitem>
316+ <para>
317+ In <literal>intelligent</> and <literal>controlled</> modes,
318+ <filename>aqo</filename> statistics is only used for the
319+ alreadyknown query types.
320+ </para>
321+ </listitem>
322+ <listitem>
323+ <para>
324+ In the <literal>forced</> mode,
325+ <filename>aqo</filename> tries to optimize the unknown
326+ queries based on the common statistics collected in the
327+ <literal>forced</> mode on master, if any. If the common
328+ statistics is not found, <filename>aqo</filename> falls back
329+ to the default query planner. All the known query types continue using
330+ the available statistics.
331+ </para>
332+ </listitem>
333+ <listitem>
334+ <para>
335+ The <literal>disabled</literal> mode switches off the collected
336+ statistics completely, relying on the default query planner
337+ for all queries.
338+ </para>
339+ </listitem>
340+ </itemizedlist>
341+ </para>
342+ <para>
343+ If you fine-tuned optimization settings for specific query types
344+ on master, these settings override the default <filename>aqo</filename>
345+ behavior, unless you choose the <literal>disabled</literal> mode.
346+ For details, see <xref linkend="aqo-advanced-query-tuning">.
347+ </para>
348+ </sect3>
301349 </sect2>
302350 <sect2 id="aqo-reference">
303351 <title>Reference</title>
0 commit comments