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
If you often run queries of the same type, for example, you application limits the number
124
+
If you often run queries of the same type, for example, your application limits the number
125
125
of possible query types, you can use the <literal>intelligent</literal> mode to
126
126
improve planning for these queries. In this mode, <filename>aqo</filename>
127
127
analyzes each query execution and stores statistics. Statistics on queries of
@@ -170,7 +170,7 @@ SET aqo.mode = 'controlled';
170
170
When run in the <literal>intelligent</literal> mode, <filename>aqo</filename> assigns a unique hash value
171
171
to each query type to separate the collected statistics. If you
172
172
switch to the <literal>forced</literal> mode, the statistics for all untracked query
173
-
types is stored in common query type with hash 0. You can view all
173
+
types is stored in a common query type with hash 0. You can view all
174
174
the processed query types and their corresponding hash values in
175
175
the <structname>aqo_query_texts</structname> table:
176
176
</para>
@@ -231,7 +231,7 @@ SELECT * FROM aqo_queries;
231
231
232
232
SET aqo.mode='intelligent';
233
233
SELECT * FROM a, b WHERE a.id=b.id;
234
-
SET aqo.mode='manual';
234
+
SET aqo.mode='controlled';
235
235
236
236
-- Disable auto_tuning, enable both learn_aqo and use_aqo
237
237
-- for this query type:
@@ -263,7 +263,7 @@ DELETE FROM aqo_data;
263
263
</programlisting>
264
264
<para>
265
265
Alternatively, you can specify a particular query type to reset by
266
-
providing its hash value in the <literal>fspase_hash</literal> option. For example:
266
+
providing its hash value in the <literal>fspace_hash</literal> option. For example:
267
267
</para>
268
268
<programlisting>
269
269
DELETE FROM aqo_data WHERE fspace_hash = (SELECT fspace_hash FROM aqo_queries
@@ -325,7 +325,7 @@ UPDATE aqo_queries SET use_aqo=false, learn_aqo=false, auto_tuning=false;
325
325
<entry>Optimizes all queries together, regardless of the query type.</entry>
326
326
</row>
327
327
<row>
328
-
<entry><literal>manual</literal></entry>
328
+
<entry><literal>controlled</literal></entry>
329
329
<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>
330
330
</row>
331
331
<row>
@@ -424,7 +424,7 @@ UPDATE aqo_queries SET use_aqo=false, learn_aqo=false, auto_tuning=false;
424
424
intelligent mode. In other modes, new queries are not
425
425
appended to <structname>aqo_queries</structname> automatically.
426
426
You can change this behavior by setting the
427
-
<literal>auto_tuning</literal> variable to TRUE.</entry>
427
+
<literal>auto_tuning</literal> variable to <literal>true</literal>.</entry>
Copy file name to clipboardExpand all lines: doc/src/sgml/atx.sgml
+42-42Lines changed: 42 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -1,102 +1,102 @@
1
1
<!-- doc/src/sgml/atx.sgml -->
2
2
3
3
<chapter id="atx">
4
-
<title>Autonomous transactions</title>
4
+
<title>Autonomous Transactions</title>
5
5
6
6
<sect1 id="atx-overview">
7
-
<title>Overview of autonomous transactions</title>
7
+
<title>Overview</title>
8
8
9
9
<para>
10
10
&productname; supports nested transactions: they are rarely explicitly used by programmer and mostly used for error handling and stored
11
-
procedures. It is possible to rollback subtransaction without affecting parent transaction. But commit of subtraction is delayed until
11
+
procedures. It is possible to rollback a subtransaction without affecting the parent transaction. But commit of a subtraction is delayed until
12
12
commit of parent transaction.
13
13
</para>
14
14
<para>
15
-
But in some cases application needs to run several independent transactions in one session.
16
-
<quote>Autonomous Subtransactions</quote> (in short <acronym>AST</acronym>) denotes the capability of a single session
17
-
to run multiple independent transactions, as if multiple different sessions were executing each transaction.
18
-
</para>
19
-
<para>
20
-
Autonomous transactions are needed mostly for implementing audits, when the fact of performing audit should be reported regardless
21
-
status of audit itself: whether it was successfully completed or not.
22
-
Autonomous transactions are widely used in Oracle PL-SQL, so porting such procedures to &productname; is problematic without autonomous transaction support.
15
+
However, in some cases applications need to run several independent transactions inside a single transaction — <quote>autonomous transactions</quote>. Autonomous transactions are needed mostly for implementing audits, when the fact of performing an audit should be reported regardless of the
16
+
status of the audit itself: whether it was successfully completed or not.
23
17
</para>
24
18
25
19
</sect1>
26
20
27
21
<sect1><title>Behavior</title>
28
22
<para>
29
-
An <acronym>AST</acronym> can happen only inside another transaction.
30
-
Inside an existing transaction (call it T0), the user can decide to start a subtransaction. Then T0 is paused and pushed in an <acronym>AST</acronym> stack, and a new transaction (call it T1) is started.
23
+
An autonomous transaction can happen only inside another transaction.
24
+
Inside an existing transaction (call it T0), the user can decide to start an autonomous transaction. Then T0 is paused and pushed in an autonomous transaction stack, and a new transaction (call it T1) is started.
31
25
</para>
32
26
<para>
33
-
At some point in the future the user can commit the subtransaction; after T1 is committed then T0 is popped from the <acronym>AST</acronym> stack and resumed.
34
-
The user can also decide to <command>COMMIT</command> the parent transaction T0, in which case T1 is committed, then T0 is popped from the <acronym>AST</acronym> stack and then committed.
27
+
At some point in the future the user can commit the autonomous transaction; after T1 is committed then T0 is popped from the autonomous transaction stack and resumed.
28
+
The user can also decide to <command>COMMIT</command> the parent transaction T0, in which case T1 is committed, then T0 is popped from the autonomous transaction stack and then committed.
35
29
</para>
36
30
<para>
37
31
All the transactions happen synchronously; at any time only one transaction can be active, while in the stack there are zero (or more) paused transactions in the stack.
38
32
All the possible combinations of <command>COMMIT</command> / <command>ROLLBACK</command> for T0 and T1 can happen;
39
33
for instance, it is possible to COMMIT T1 and ROLLBACK T0.
40
-
It is possible to nest subtransactions, up to a global resource limit (e.g. the <acronym>AST</acronym> stack size) which can be set on the server.
34
+
It is possible to nest autonomous transactions, up to a global resource limit (e.g. the autonomous transaction stack size) which can be set on the server.
41
35
</para>
42
36
43
37
</sect1>
44
38
45
-
<sect1><title>Example</title>
39
+
<sect1><title>Examples</title>
46
40
47
41
<para>
48
-
The following figure describes an example where a transaction executes a subtransaction. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in the <acronym>AST</acronym> stack. Time flows downwards.
42
+
This example illustrates how an autonomous transaction is executed. A continuous line denotes an active transaction, while a dotted line denotes a transaction which has been paused and pushed in the autonomous transaction stack. Time flows downwards.
49
43
</para>
50
44
51
45
<programlisting>
52
-
BEGIN; -- start ordinary tx T0
46
+
BEGIN; -- starts ordinary transaction T0
53
47
|
54
48
INSERT INTO t VALUES (1);
55
49
:\
56
-
: BEGIN AUTONOMOUS TRANSACTION; -- start AST tx T1, pushes T0 into stack
50
+
: BEGIN AUTONOMOUS TRANSACTION; -- starts autonomous transaction
Visibility rules work as in the case of independent transactions executed via <literal>dblink</literal>.
108
108
T1 does not see the effects of T0, because the latter has not been committed yet. T0 might see the effects of T1, depending on its own transaction isolation mode.
109
-
In case of Read Committed isolation level the parent transaction will see changes made by autonomous subtransaction.
110
-
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomous subtransaction.
109
+
In case of Read Committed isolation level the parent transaction will see changes made by autonomous transactions.
110
+
But in case of Repeatable Read isolation level the parent transaction will not see changes made by autonomous transactions.
111
111
</para>
112
112
113
113
<para>
114
-
Now single-session deadlocks become possible, because an <acronym>AST</acronym> can become entangled with one of the paused transactions in it's session.
114
+
Now single-session deadlocks become possible, because an autonomous transaction can become entangled with one of the paused transactions in its session.
115
115
Autonomous transaction T1 is assumed to depend on parent transaction T0 and if it attempts to obtain any resource locked by T0, then
116
116
deadlock is reported.
117
117
</para>
118
118
119
119
</sect1>
120
120
121
-
<sect1><title>SQL grammar extension for autonomous transactions</title>
121
+
<sect1><title>SQL Grammar Extension for Autonomous Transactions</title>
122
122
123
123
<para>
124
124
&productname; <literal>BEGIN</literal>/<literal>END</literal> transaction statements are extended by optional keyword <literal>AUTONOMOUS</literal>:
@@ -131,16 +131,16 @@ deadlock is reported.
131
131
132
132
<para>
133
133
Specifying <literal>AUTONOMOUS</literal> keyword in <literal>END TRANSACTION</literal> clause is optional.
134
-
It is possible to have several nesting levels of autonomous transactions, but top level transaction can not be autonomous.
134
+
It is possible to have several nesting levels of autonomous transactions, but top level transaction cannot be autonomous.
135
135
</para>
136
136
137
137
</sect1>
138
138
139
-
<sect1><title>PL/pgSQL grammar extension for autonomous transactions</title>
139
+
<sect1><title>PL/pgSQL Grammar Extension for Autonomous Transactions</title>
140
140
141
141
<para>
142
142
Block construction in PL/pgSQL is extended by optional <literal>autonomous</literal> keyword.
143
-
It is possible to treat all function body as autonomous transaction:
143
+
It is possible to treat the whole function body as an autonomous transaction:
144
144
</para>
145
145
146
146
<programlisting>
@@ -178,11 +178,11 @@ When an error is caught by an <literal>EXCEPTION</literal> clause, the local var
178
178
179
179
</sect1>
180
180
181
-
<sect1><title>PL/Python extension for autonomous transactions</title>
181
+
<sect1><title>PL/Python Extension for Autonomous Transactions</title>
182
182
183
183
<para>
184
184
In addition to <varname>subtransaction</varname> method, PL/Python module provides new <varname>autonomous</varname> method
185
-
which can be used in <varname>WITH</varname> clause to start autonomous transaction:
185
+
which can be used in <varname>WITH</varname> clause to start an autonomous transaction:
0 commit comments