You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You should preload the `aqo` library at the server startup, since
59
-
adaptive query optimization needs to be enabled per database, not per connection. Otherwise, all the collected statistics will be lost when the session ends.
59
+
adaptive query optimization needs to be enabled per cluster. Otherwise, the <filename>aqo</filename> will only be used for the session in which you created the <filename>aqo</filename> extension.
this mode tries to optimize all queries together, regardless of
110
110
the query type.
111
111
</para>
112
-
</listitem>
112
+
</listitem>
113
113
<listitem>
114
-
<para>
115
-
<literal>aqo.mode = 'manual'</literal> - this mode
114
+
<para>
115
+
<varname>aqo.mode</varname> = <literal>'manual'</literal> — this mode
116
116
uses the default planner for all new queries, but can reuse the
117
117
collected statistics for already known query types, if any.
118
118
</para>
119
119
</listitem>
120
+
<listitem>
121
+
<para>
122
+
<varname>aqo.mode</varname> = <literal>'disabled'</literal> — this mode
123
+
disables <filename>aqo</filename> for all queries, even for the known query types.
124
+
You can use this mode to temporarily disable <filename>aqo</filename> without losing
125
+
the collected statistics and configuration.
126
+
</para>
127
+
</listitem>
120
128
</itemizedlist>
121
129
<para>
122
130
To dynamically change the <filename>aqo</filename> settings in your current session,
123
131
run the following command:
124
132
<programlisting>
125
-
SET aqo.mode = <replaceable>'mode'</>;
133
+
SET aqo.mode = '<replaceable>mode</>';
126
134
</programlisting>
127
135
where <replaceable>mode</> is the name of the optimization mode to use.
128
136
</para>
@@ -145,15 +153,15 @@ where <replaceable>mode</> is the name of the optimization mode to use.
145
153
<blockquote>
146
154
<para>
147
155
<emphasis role="strong">Note:</emphasis> You can view the
148
-
current query plan using the standard PostgreSQL <command>EXPLAIN</> command with the
149
-
<command>ANALYZE</> option. For details, see the <link linkend="using-explain">Using EXPLAIN</link> section.
156
+
current query plan using the standard <productname>PostgreSQL</productname> <command>EXPLAIN</> command with the
157
+
<command>ANALYZE</> option. For details, see the <xref linkend="using-explain">.
150
158
</para>
151
159
</blockquote>
152
160
<para>
153
161
Since the intelligent mode tries to learn separately for
154
162
different query types, <filename>aqo</filename> may fail to optimize queries with
155
163
dynamic structure. For such cases, reset the <filename>aqo</filename> extension to
156
-
the manual mode, or try using the forced mode.
164
+
the <literal>manual</literal> mode, or try using the forced mode.
157
165
</para>
158
166
<para>
159
167
In the <literal>forced</literal> mode, <filename>aqo</filename> ignores different
@@ -163,7 +171,7 @@ where <replaceable>mode</> is the name of the optimization mode to use.
163
171
mode. However, since the <literal>forced</literal> mode lacks
164
172
intelligent tuning, performance may decrease for some queries.
165
173
If you see performance issues in this mode, switch <filename>aqo</filename> to the
166
-
manual mode.
174
+
<literal>manual</literal> mode.
167
175
</para>
168
176
<para>
169
177
When you have reached the required optimization level in the intelligent mode, you can stop performance tuning by switching <filename>aqo</filename> to the manual mode:
@@ -172,11 +180,12 @@ where <replaceable>mode</> is the name of the optimization mode to use.
172
180
SET aqo.mode = 'manual';
173
181
</programlisting>
174
182
<para>
175
-
In the manual mode, <filename>aqo</filename> does not collect statistics for new
183
+
In the <literal>manual</literal> mode, <filename>aqo</filename> does not collect statistics for new
176
184
query types, so they will not be optimized. For known query
177
185
types, <filename>aqo</filename> will continue using the optimized planning
178
186
algorithms.
179
187
</para>
188
+
<para>If you want to fully disable <filename>aqo</filename>, you can switch <filename>aqo</filename> to the <literal>disabled</literal> mode. In this case, the default planner is used for all queries, but the collected statistics and <filename>aqo</filename> settings are saved and can be used in the future. </para>
180
189
</sect3>
181
190
<sect3 id="aqo-advanced-query-tuning">
182
191
<title>Advanced Query Tuning</title>
@@ -239,7 +248,7 @@ SELECT * FROM aqo_queries;
239
248
<para>
240
249
<literal>auto_tuning</literal> shows whether
241
250
<filename>aqo</filename> tries to tune other settings for the
242
-
given query. By default, auto-tuning in enabled in the
251
+
given query. By default, auto-tuning is enabled in the
243
252
intelligent mode.
244
253
</para>
245
254
</listitem>
@@ -294,7 +303,7 @@ DELETE FROM aqo_data WHERE fspace_hash = (SELECT fspace_hash FROM aqo_queries
294
303
<para>
295
304
To stop intelligent tuning for a particular query type, disable the <literal>auto_tuning</literal> setting:
296
305
<programlisting>
297
-
UPDATE aqo_queries SET auto_tuning=false WHERE query_hash = '<replaceable>hash</>';
306
+
UPDATE aqo_queries SET auto_tuning=false WHERE query_hash = '<replaceable>hash</>';
298
307
</programlisting>
299
308
where <replaceable>hash</> is the hash value for this query type. As a result, <filename>aqo</filename> disables automatic changing of the <literal>learn_aqo</literal> and <literal>use_aqo</literal> settings.
300
309
</para>
@@ -303,7 +312,7 @@ DELETE FROM aqo_data WHERE fspace_hash = (SELECT fspace_hash FROM aqo_queries
303
312
To disable further learning for a particular query type, use the
304
313
following command:
305
314
<programlisting>
306
-
UPDATE aqo_queries SET learn_aqo=false WHERE query_hash = '<replaceable>hash</>';
315
+
UPDATE aqo_queries SET learn_aqo=false WHERE query_hash = '<replaceable>hash</>';
307
316
</programlisting>
308
317
where <replaceable>hash</> is the hash value for this query type.
309
318
</para>
@@ -348,6 +357,10 @@ UPDATE aqo_queries SET use_aqo=false, learn_aqo=false, auto_tuning=false;
348
357
<entry><literal>manual</literal></entry>
349
358
<entry><emphasis role="strong">Default.</emphasis> Uses the default planner for all new queries, but can reuse the collected statistics for already known query types, if any.</entry>
350
359
</row>
360
+
<row>
361
+
<entry><literal>disabled</literal></entry>
362
+
<entry>Fully disables <filename>aqo</filename> for all queries. The collected statistics and <filename>aqo</filename> settings are saved and can be used in the future. </entry>
0 commit comments