Skip to content

Commit af6c0c8

Browse files
authored
Merge pull request #399 from ChenHuajun/master
翻译14 analyze.sgml等
2 parents a78f8e9 + 8056ed1 commit af6c0c8

File tree

3 files changed

+79
-32
lines changed

3 files changed

+79
-32
lines changed

postgresql/doc/src/sgml/ref/analyze.sgml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,13 @@ ____________________________________________________________________________-->
296296
just after making major changes in the contents of a table. Accurate
297297
statistics will help the planner to choose the most appropriate query
298298
plan, and thereby improve the speed of query processing. A common
299-
strategy for read-mostly databases is to run <xref linkend="sql-vacuum"/>
299+
strategy for read-mostly databases is to run <link linkend="sql-vacuum"><command>VACUUM</command></link>
300300
and <command>ANALYZE</command> once a day during a low-usage time of day.
301301
(This will not be sufficient if there is heavy update activity.)
302302
</para>
303303
____________________________________________________________________________-->
304304
<para>
305-
在默认的<productname>PostgreSQL</productname>配置中,自动清理守护进程(见<xref linkend="autovacuum"/>)会在表第一次载入数据或者用常规操作改变时负责表的自动分析。当启用自动清理时,定期运行<command>ANALYZE</command>是个好主意,或者可以在表内容做了大的修改后运行<command>ANALYZE</command>。准确的统计信息将帮助规划器选择最合适的查询计划,从而提升查询处理的速度。主读数据库的一般策略是在一天中使用量最低时运行一次<xref linkend="sql-vacuum"/>和<command>ANALYZE</command>(如果有大量的更新动作则是不够的)。
305+
在默认的<productname>PostgreSQL</productname>配置中,自动清理守护进程(见<xref linkend="autovacuum"/>)会在表第一次载入数据或者用常规操作改变时负责表的自动分析。当启用自动清理时,定期运行<command>ANALYZE</command>是个好主意,或者可以在表内容做了大的修改后运行<command>ANALYZE</command>。准确的统计信息将帮助规划器选择最合适的查询计划,从而提升查询处理的速度。主读数据库的一般策略是在一天中使用量最低时运行一次<link linkend="sql-vacuum"><command>VACUUM</command></link>和<command>ANALYZE</command>(如果有大量的更新动作则是不够的)。
306306
</para>
307307

308308
<!--==========================orignal english content==========================
@@ -342,24 +342,24 @@ ____________________________________________________________________________-->
342342
will change slightly each time <command>ANALYZE</command> is run,
343343
even if the actual table contents did not change. This might result
344344
in small changes in the planner's estimated costs shown by
345-
<xref linkend="sql-explain"/>.
345+
<link linkend="sql-explain"><command>EXPLAIN</command></link>.
346346
In rare situations, this non-determinism will cause the planner's
347347
choices of query plans to change after <command>ANALYZE</command> is run.
348348
To avoid this, raise the amount of statistics collected by
349349
<command>ANALYZE</command>, as described below.
350350
</para>
351351
____________________________________________________________________________-->
352352
<para>
353-
对于大型的表,<command>ANALYZE</command>会对表内容做随机采样而不是检查每一行。这允许在很少的时间内完成对大型表的分析。不过要注意,这些统计信息只是近似值,并且即使实际表内容没有改变,每次运行<command>ANALYZE</command>时统计信息都会有微小地改变。这可能会导致<xref linkend="sql-explain"/>显示的规划器估算代价有小的改变。在很少的情况下,这会非决定性地导致规划器的查询计划选择在<command>ANALYZE</command>运行后改变。为了避免这种情况,可以按照下文所述提高<command>ANALYZE</command>所收集的统计信息量。
353+
对于大型的表,<command>ANALYZE</command>会对表内容做随机采样而不是检查每一行。这允许在很少的时间内完成对大型表的分析。不过要注意,这些统计信息只是近似值,并且即使实际表内容没有改变,每次运行<command>ANALYZE</command>时统计信息都会有微小地改变。这可能会导致<link linkend="sql-explain"><command>EXPLAIN</command></link>显示的规划器估算代价有小的改变。在很少的情况下,这会非决定性地导致规划器的查询计划选择在<command>ANALYZE</command>运行后改变。为了避免这种情况,可以按照下文所述提高<command>ANALYZE</command>所收集的统计信息量。
354354
</para>
355355

356356
<!--==========================orignal english content==========================
357357
<para>
358358
The extent of analysis can be controlled by adjusting the
359359
<xref linkend="guc-default-statistics-target"/> configuration variable, or
360360
on a column-by-column basis by setting the per-column statistics
361-
target with <command>ALTER TABLE ... ALTER COLUMN ... SET
362-
STATISTICS</command> (see <xref linkend="sql-altertable"/>).
361+
target with <link linkend="sql-altertable"><command>ALTER TABLE ... ALTER COLUMN ... SET
362+
STATISTICS</command></link>.
363363
The target value sets the
364364
maximum number of entries in the most-common-value list and the
365365
maximum number of bins in the histogram. The default target value
@@ -375,7 +375,7 @@ ____________________________________________________________________________-->
375375
</para>
376376
____________________________________________________________________________-->
377377
<para>
378-
通过调整<xref linkend="guc-default-statistics-target"/>配置变量可以控制分析量,对每个列可以用<command>ALTER TABLE ... ALTER COLUMN ... SET STATISTICS</command>设置每列的统计信息目标(见<xref linkend="sql-altertable"/>)。目标值会设置最常用值列表中的最大项数以及直方图中的最大容器数。默认目标值是 100,可以把它调大或者调小在规划器估计值精度和<command>ANALYZE</command>花费的时间以及<literal>pg_statistic</literal>所占空间之间做出平衡。特别地,将统计信息目标设置为零会禁用该列的统计信息收集。在查询的<literal>WHERE</literal>、<literal>GROUP BY</literal>或者<literal>ORDER BY</literal>子句中从不出现的列上这样做会有所帮助,因为规划器用不上这些列上的统计信息。
378+
通过调整<xref linkend="guc-default-statistics-target"/>配置变量可以控制分析量,对每个列可以用<link linkend="sql-altertable"><command>ALTER TABLE ... ALTER COLUMN ... SET STATISTICS</command></link>设置每列的统计信息目标。目标值会设置最常用值列表中的最大项数以及直方图中的最大容器数。默认目标值是 100,可以把它调大或者调小在规划器估计值精度和<command>ANALYZE</command>花费的时间以及<literal>pg_statistic</literal>所占空间之间做出平衡。特别地,将统计信息目标设置为零会禁用该列的统计信息收集。在查询的<literal>WHERE</literal>、<literal>GROUP BY</literal>或者<literal>ORDER BY</literal>子句中从不出现的列上这样做会有所帮助,因为规划器用不上这些列上的统计信息。
379379
</para>
380380

381381
<!--==========================orignal english content==========================
@@ -398,12 +398,11 @@ ____________________________________________________________________________-->
398398
with the largest possible statistics target. If this inaccuracy leads to
399399
bad query plans, a more accurate value can be determined manually and then
400400
installed with
401-
<command>ALTER TABLE ... ALTER COLUMN ... SET (n_distinct = ...)</command>
402-
(see <xref linkend="sql-altertable"/>).
401+
<link linkend="sql-altertable"><command>ALTER TABLE ... ALTER COLUMN ... SET (n_distinct = ...)</command></link>.
403402
</para>
404403
____________________________________________________________________________-->
405404
<para>
406-
<command>ANALYZE</command>所估算的值之一是出现在每个列中的可区分值。因为只会检查行的一个子集,即便使用最大的统计信息目标,这种估计有时也可能很不精确。如果这种不精确导致不好的查询计划,可以手工确定一个更精确的值并且用<command>ALTER TABLE ... ALTER COLUMN ... SET (n_distinct = ...)</command>设置该值(见<xref linkend="sql-altertable"/>)
405+
<command>ANALYZE</command>所估算的值之一是出现在每个列中的可区分值。因为只会检查行的一个子集,即便使用最大的统计信息目标,这种估计有时也可能很不精确。如果这种不精确导致不好的查询计划,可以手工确定一个更精确的值并且用<link linkend="sql-altertable"><command>ALTER TABLE ... ALTER COLUMN ... SET (n_distinct = ...)</command></link>设置该值
407406
</para>
408407

409408
<!--==========================orignal english content==========================
@@ -445,6 +444,18 @@ ____________________________________________________________________________-->
445444
<para>
446445
如果被分析的表不完全为空,<command>ANALYZE</command>将不会为该表记录新统计信息。任何现有统计信息将会被保留。
447446
</para>
447+
448+
<!--==========================orignal english content==========================
449+
<para>
450+
Each backend running <command>ANALYZE</command> will report its progress
451+
in the <structname>pg_stat_progress_analyze</structname> view. See
452+
<xref linkend="analyze-progress-reporting"/> for details.
453+
</para>
454+
____________________________________________________________________________-->
455+
<para>
456+
每个运行<command>ANALYZE</command>的后端将会在<structname>pg_stat_progress_analyze</structname>
457+
视图中报告其进度。详细参考<xref linkend="analyze-progress-reporting"/>。
458+
</para>
448459
</refsect1>
449460

450461
<refsect1>
@@ -474,6 +485,7 @@ ____________________________________________________________________________-->
474485
<member><xref linkend="app-vacuumdb"/></member>
475486
<member><xref linkend="runtime-config-resource-vacuum-cost"/></member>
476487
<member><xref linkend="autovacuum"/></member>
488+
<member><xref linkend="analyze-progress-reporting"/></member>
477489
</simplelist>
478490
</refsect1>
479491
</refentry>

postgresql/doc/src/sgml/ref/begin.sgml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ ____________________________________________________________________________-->
7070
<para>
7171
<command>BEGIN</command> initiates a transaction block, that is,
7272
all statements after a <command>BEGIN</command> command will be
73-
executed in a single transaction until an explicit <xref
74-
linkend="sql-commit"/> or <xref
75-
linkend="sql-rollback"/> is given.
73+
executed in a single transaction until an explicit <link
74+
linkend="sql-commit"><command>COMMIT</command></link> or <link
75+
linkend="sql-rollback"><command>ROLLBACK</command></link> is given.
7676
By default (without <command>BEGIN</command>),
7777
<productname>PostgreSQL</productname> executes
7878
transactions in <quote>autocommit</quote> mode, that is, each
@@ -84,9 +84,9 @@ ____________________________________________________________________________-->
8484
<para>
8585
<command>BEGIN</command>开始一个事务块,也就是说所有
8686
<command>BEGIN</command>命令之后的所有语句将被在一个
87-
事务中执行,直到给出一个显式的<xref linkend="sql-commit"/>或
88-
者<xref linkend="sql-rollback"/>。默认情况下(没有
89-
<command>BEGIN</command>),
87+
事务中执行,直到给出一个显式的<link linkend="sql-commit"><command>COMMIT</command></link>
88+
或者<link linkend="sql-rollback"><command>ROLLBACK</command></link>。
89+
默认情况下(没有<command>BEGIN</command>),
9090
<productname>PostgreSQL</productname>在
9191
<quote>自动提交</quote>模式中执行事务,也就是说每个语句都
9292
在自己的事务中执行并且在语句结束时隐式地执行一次提交(如果执
@@ -114,13 +114,13 @@ ____________________________________________________________________________-->
114114
<para>
115115
If the isolation level, read/write mode, or deferrable mode is specified, the new
116116
transaction has those characteristics, as if
117-
<xref linkend="sql-set-transaction"/>
117+
<link linkend="sql-set-transaction"><command>SET TRANSACTION</command></link>
118118
was executed.
119119
</para>
120120
____________________________________________________________________________-->
121121
<para>
122122
如果指定了隔离级别、读/写模式或者延迟模式,新事务也会有那些特性,
123-
就像执行了<xref linkend="sql-set-transaction"/>一样。
123+
就像执行了<link linkend="sql-set-transaction"><command>SET TRANSACTION</command></link>一样。
124124
</para>
125125
</refsect1>
126126

@@ -173,25 +173,25 @@ ____________________________________________________________________________-->
173173

174174
<!--==========================orignal english content==========================
175175
<para>
176-
<xref linkend="sql-start-transaction"/> has the same functionality
176+
<link linkend="sql-start-transaction"><command>START TRANSACTION</command></link> has the same functionality
177177
as <command>BEGIN</command>.
178178
</para>
179179
____________________________________________________________________________-->
180180
<para>
181-
<xref linkend="sql-start-transaction"/>具有和<command>BEGIN</command>
181+
<link linkend="sql-start-transaction"><command>START TRANSACTION</command></link>具有和<command>BEGIN</command>
182182
相同的功能。
183183
</para>
184184

185185
<!--==========================orignal english content==========================
186186
<para>
187-
Use <xref linkend="sql-commit"/> or
188-
<xref linkend="sql-rollback"/>
187+
Use <link linkend="sql-commit"><command>COMMIT</command></link> or
188+
<link linkend="sql-rollback"><command>ROLLBACK</command></link>
189189
to terminate a transaction block.
190190
</para>
191191
____________________________________________________________________________-->
192192
<para>
193-
使用<xref linkend="sql-commit"/>或者
194-
<xref linkend="sql-rollback"/>来终止一个事务块。
193+
使用<link linkend="sql-commit"><command>COMMIT</command></link>或者
194+
<link linkend="sql-rollback"><command>ROLLBACK</command></link>来终止一个事务块。
195195
</para>
196196

197197
<!--==========================orignal english content==========================
@@ -254,14 +254,14 @@ ____________________________________________________________________________-->
254254
<para>
255255
<command>BEGIN</command> is a <productname>PostgreSQL</productname>
256256
language extension. It is equivalent to the SQL-standard command
257-
<xref linkend="sql-start-transaction"/>, whose reference page
257+
<link linkend="sql-start-transaction"><command>START TRANSACTION</command></link>, whose reference page
258258
contains additional compatibility information.
259259
</para>
260260
____________________________________________________________________________-->
261261
<para>
262262
<command>BEGIN</command>是一种
263263
<productname>PostgreSQL</productname>语言扩展。它等效于
264-
SQL 标准的命令<xref linkend="sql-start-transaction"/>,它的参考页
264+
SQL 标准的命令<link linkend="sql-start-transaction"><command>START TRANSACTION</command></link>,它的参考页
265265
包含额外的兼容性信息。
266266
</para>
267267

postgresql/doc/src/sgml/ref/call.sgml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,44 @@ ____________________________________________________________________________-->
106106
<listitem>
107107
<!--==========================orignal english content==========================
108108
<para>
109-
An input argument for the procedure call.
110-
See <xref linkend="sql-syntax-calling-funcs"/> for the full details on
111-
function and procedure call syntax, including use of named parameters.
109+
An argument expression for the procedure call.
112110
</para>
113111
____________________________________________________________________________-->
114112
<para>
115-
过程调用的一个输入参数。函数和过程调用语法的完整细节(包括参数的使用)请参考<xref linkend="sql-syntax-calling-funcs"/>。
113+
过程调用的一个参数表达式。
114+
</para>
115+
116+
<!--==========================orignal english content==========================
117+
<para>
118+
Arguments can include parameter names, using the syntax
119+
<literal><replaceable class="parameter">name</replaceable> =&gt; <replaceable class="parameter">value</replaceable></literal>.
120+
This works the same as in ordinary function calls; see
121+
<xref linkend="sql-syntax-calling-funcs"/> for details.
122+
</para>
123+
____________________________________________________________________________-->
124+
<para>
125+
参数可以包括参数名称,使用语法为
126+
<literal><replaceable class="parameter">name</replaceable> =&gt; <replaceable class="parameter">value</replaceable></literal>。
127+
这与普通函数调用的工作方式相同。
128+
详细参考<xref linkend="sql-syntax-calling-funcs"/>。
129+
</para>
130+
131+
<!--==========================orignal english content==========================
132+
<para>
133+
Arguments must be supplied for all procedure parameters that lack
134+
defaults, including <literal>OUT</literal> parameters. However,
135+
arguments matching <literal>OUT</literal> parameters are not evaluated,
136+
so it's customary to just write <literal>NULL</literal> for them.
137+
(Writing something else for an <literal>OUT</literal> parameter
138+
might cause compatibility problems with
139+
future <productname>PostgreSQL</productname> versions.)
140+
</para>
141+
____________________________________________________________________________-->
142+
<para>
143+
必须为所有缺少默认值的过程参数提供参数值,包括<literal>OUT</literal>参数。
144+
然而,匹配<literal>OUT</literal>参数的参数不会被求值,因此通常为它们代入<literal>NULL</literal>。
145+
(为<literal>OUT</literal>参数代入其他内容可能会导致与未来的
146+
<productname>PostgreSQL</productname>版本的兼容问题。)
116147
</para>
117148
</listitem>
118149
</varlistentry>
@@ -191,11 +222,15 @@ ____________________________________________________________________________-->
191222

192223
<!--==========================orignal english content==========================
193224
<para>
194-
<command>CALL</command> conforms to the SQL standard.
225+
<command>CALL</command> conforms to the SQL standard,
226+
except for the handling of output parameters. The standard
227+
says that users should write variables to receive the values
228+
of output parameters.
195229
</para>
196230
____________________________________________________________________________-->
197231
<para>
198-
<command>CALL</command>符合SQL标准。
232+
<command>CALL</command>符合SQL标准,除了输出参数的处理。
233+
该标准规定,用户应该编写变量来接收输出参数的值。
199234
</para>
200235
</refsect1>
201236

0 commit comments

Comments
 (0)