Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd90c531

Browse files
committed
Autovacuum loose end mop-up. Provide autovacuum-specific vacuum cost
delay and limit, both as global GUCs and as table-specific entries inpg_autovacuum. stats_reset_on_server_start is now OFF by default,but a reset is forced if we did WAL replay. XID-wrap vacuums do notANALYZE, but do FREEZE if it's a template database. Alvaro Herrera
1 parentf6c30d5 commitd90c531

File tree

18 files changed

+449
-202
lines changed

18 files changed

+449
-202
lines changed

‎doc/src/sgml/catalogs.sgml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
22
Documentation of the system catalogs, directed toward PostgreSQL developers
3-
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.110 2005/07/31 17:19:16 tgl Exp $
3+
$PostgreSQL: pgsql/doc/src/sgml/catalogs.sgml,v 2.111 2005/08/11 21:11:41 tgl Exp $
44
-->
55

66
<chapter id="catalogs">
@@ -1197,6 +1197,20 @@
11971197
<entry>Multiplier for reltuples to add to
11981198
<structfield>anl_base_thresh</></entry>
11991199
</row>
1200+
1201+
<row>
1202+
<entry><structfield>vac_cost_delay</structfield></entry>
1203+
<entry><type>integer</type></entry>
1204+
<entry></entry>
1205+
<entry>Custom <varname>vacuum_cost_delay</> parameter</entry>
1206+
</row>
1207+
1208+
<row>
1209+
<entry><structfield>vac_cost_limit</structfield></entry>
1210+
<entry><type>integer</type></entry>
1211+
<entry></entry>
1212+
<entry>Custom <varname>vacuum_cost_limit</> parameter</entry>
1213+
</row>
12001214
</tbody>
12011215
</tgroup>
12021216
</table>
@@ -1217,7 +1231,11 @@
12171231
<para>
12181232
Any of the numerical fields can contain <literal>-1</> (or indeed
12191233
any negative value) to indicate that the system-wide default should
1220-
be used for this particular value.
1234+
be used for this particular value. Observe that the
1235+
<structfield>vac_cost_delay</> variable inherits its default value from the
1236+
<varname>autovacuum_vacuum_cost_delay</> configuration parameter,
1237+
or from <varname>vacuum_cost_delay</> if the former is set to a negative
1238+
value. The same applies to <structfield>vac_cost_limit</>.
12211239
</para>
12221240

12231241
</sect1>

‎doc/src/sgml/runtime.sgml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.343 2005/08/09 05:01:10 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.344 2005/08/11 21:11:42 tgl Exp $
33
-->
44

55
<chapter Id="runtime">
@@ -3296,7 +3296,7 @@ SELECT * FROM parent WHERE key = 2400;
32963296
<para>
32973297
If on, collected statistics are zeroed out whenever the server
32983298
is restarted. If off, statistics are accumulated across server
3299-
restarts. The default is <literal>on</>. This option can only
3299+
restarts. The default is <literal>off</>. This option can only
33003300
be set at server start.
33013301
</para>
33023302
</listitem>
@@ -3424,6 +3424,40 @@ SELECT * FROM parent WHERE key = 2400;
34243424
</listitem>
34253425
</varlistentry>
34263426

3427+
<varlistentry id="guc-autovacuum-vacuum-cost-delay" xreflabel="autovacuum_vacuum_cost_delay">
3428+
<term><varname>autovacuum_vacuum_cost_delay</varname> (<type>integer</type>)</term>
3429+
<indexterm>
3430+
<primary><varname>autovacuum_vacuum_cost_delay</> configuration parameter</primary>
3431+
</indexterm>
3432+
<listitem>
3433+
<para>
3434+
Specifies the cost delay value that will be used in automatic
3435+
<command>VACUUM</> operations. If -1 is specified (which is the
3436+
default), the regular
3437+
<xref linkend="guc-vacuum-cost-delay"> value will be used.
3438+
This setting can be overridden for individual tables by entries in
3439+
<structname>pg_autovacuum</>.
3440+
</para>
3441+
</listitem>
3442+
</varlistentry>
3443+
3444+
<varlistentry id="guc-autovacuum-vacuum-cost-limit" xreflabel="autovacuum_vacuum_cost_limit">
3445+
<term><varname>autovacuum_vacuum_cost_limit</varname> (<type>integer</type>)</term>
3446+
<indexterm>
3447+
<primary><varname>autovacuum_vacuum_cost_limit</> configuration parameter</primary>
3448+
</indexterm>
3449+
<listitem>
3450+
<para>
3451+
Specifies the cost limit value that will be used in automatic
3452+
<command>VACUUM</> operations. If -1 is specified (which is the
3453+
default), the regular
3454+
<xref linkend="guc-vacuum-cost-limit"> value will be used.
3455+
This setting can be overridden for individual tables by entries in
3456+
<structname>pg_autovacuum</>.
3457+
</para>
3458+
</listitem>
3459+
</varlistentry>
3460+
34273461
</variablelist>
34283462
</sect2>
34293463

‎src/backend/access/transam/xlog.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.214 2005/07/30 14:15:44 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.215 2005/08/11 21:11:43 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -33,6 +33,7 @@
3333
#include"catalog/catversion.h"
3434
#include"catalog/pg_control.h"
3535
#include"miscadmin.h"
36+
#include"pgstat.h"
3637
#include"postmaster/bgwriter.h"
3738
#include"storage/bufpage.h"
3839
#include"storage/fd.h"
@@ -48,7 +49,7 @@
4849

4950

5051
/*
51-
*Becauase O_DIRECT bypasses the kernel buffers, and because we never
52+
*Because O_DIRECT bypasses the kernel buffers, and because we never
5253
*read those buffers except during crash recovery, it is a win to use
5354
*it in all cases where we sync on each write(). We could allow O_DIRECT
5455
*with fsync(), but because skipping the kernel buffer forces writes out
@@ -4685,6 +4686,11 @@ StartupXLOG(void)
46854686
RmgrTable[rmid].rm_cleanup();
46864687
}
46874688

4689+
/*
4690+
* Reset pgstat data, because it may be invalid after recovery.
4691+
*/
4692+
pgstat_reset_all();
4693+
46884694
/*
46894695
* Perform a new checkpoint to update our recovery activity to
46904696
* disk.

‎src/backend/libpq/hba.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.146 2005/07/29 19:30:04 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.147 2005/08/11 21:11:44 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1001,13 +1001,15 @@ load_hba(void)
10011001
*dboid: gets database OID
10021002
*dbtablespace: gets database's default tablespace's OID
10031003
*dbfrozenxid: gets database's frozen XID
1004+
*dbvacuumxid: gets database's vacuum XID
10041005
*
10051006
* This is not much related to the other functions in hba.c, but we put it
10061007
* here because it uses the next_token() infrastructure.
10071008
*/
10081009
bool
10091010
read_pg_database_line(FILE*fp,char*dbname,Oid*dboid,
1010-
Oid*dbtablespace,TransactionId*dbfrozenxid)
1011+
Oid*dbtablespace,TransactionId*dbfrozenxid,
1012+
TransactionId*dbvacuumxid)
10111013
{
10121014
charbuf[MAX_TOKEN];
10131015

@@ -1030,6 +1032,10 @@ read_pg_database_line(FILE *fp, char *dbname, Oid *dboid,
10301032
if (!isdigit((unsignedchar)buf[0]))
10311033
elog(FATAL,"bad data in flat pg_database file");
10321034
*dbfrozenxid=atoxid(buf);
1035+
next_token(fp,buf,sizeof(buf));
1036+
if (!isdigit((unsignedchar)buf[0]))
1037+
elog(FATAL,"bad data in flat pg_database file");
1038+
*dbvacuumxid=atoxid(buf);
10331039
/* expect EOL next */
10341040
if (next_token(fp,buf,sizeof(buf)))
10351041
elog(FATAL,"bad data in flat pg_database file");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp