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

Commit7cce39c

Browse files
committed
The following patch should allow UPDATE_INTERVAL to be specified on the
command line. We find this useful because we frequently deal withthousands of tables in an environment where neither the databases northe tables are updated frequently. This helps allow us to cut down onthe overhead of updating the list for every other primary loop ofpg_autovacuum.I chose -i as the command-line argument and documented it briefly inthe README.The patch was applied to the 7.4.7 version of pg_autovacuum in contrib.Thomas F.O'Connell
1 parentaa8bdab commit7cce39c

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

‎contrib/pg_autovacuum/README.pg_autovacuum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ pg_autovacuum has the following optional arguments:
123123
-V vacuum scaling factor: see "Vacuum and Analyze" below.
124124
-a analyze base threshold: see "Vacuum and Analyze" below.
125125
-A analyze scaling factor: see "Vacuum and Analyze" below.
126+
-i update interval: how often (in terms of iterations of the primary loop
127+
over the database list) to update the database list. The default is 2,
128+
which means the list will be updated before every other pass through
129+
the database list.
126130
-L log file: Name of file to which output is submitted, otherwise STDERR
127131
-U username: Username pg_autovacuum will use to connect with, if not
128132
specified the current username is used.
@@ -157,6 +161,7 @@ the time of writing they are:
157161
-A 1 (half of -V if not specified)
158162
-s 300 (5 minutes)
159163
-S 2
164+
-i 2
160165

161166
The following arguments are used on Windows only:
162167

‎contrib/pg_autovacuum/pg_autovacuum.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Revisions by Christopher B. Browne, Liberty RMS
55
* Win32 Service code added by Dave Page
66
*
7-
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.30 2005/04/03 00:01:51 tgl Exp $
7+
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.31 2005/04/19 03:35:15 momjian Exp $
88
*/
99

1010
#include"postgres_fe.h"
@@ -1103,6 +1103,7 @@ get_cmd_args(int argc, char *argv[])
11031103
args->analyze_base_threshold=-1;
11041104
args->analyze_scaling_factor=-1;
11051105
args->debug=AUTOVACUUM_DEBUG;
1106+
args->update_interval=UPDATE_INTERVAL;
11061107
#ifndefWIN32
11071108
args->daemonize=0;
11081109
#else
@@ -1157,6 +1158,9 @@ get_cmd_args(int argc, char *argv[])
11571158
case'A':
11581159
args->analyze_scaling_factor=atof(optarg);
11591160
break;
1161+
case'i':
1162+
args->update_interval=atoi(optarg);
1163+
break;
11601164
case'c':
11611165
args->av_vacuum_cost_delay=atoi(optarg);
11621166
break;
@@ -1341,6 +1345,8 @@ print_cmd_args(void)
13411345
log_entry(logbuffer,LVL_INFO);
13421346
sprintf(logbuffer," args->analyze_scaling_factor=%f",args->analyze_scaling_factor);
13431347
log_entry(logbuffer,LVL_INFO);
1348+
sprintf(logbuffer," args->update_interval=%i",args->update_interval);
1349+
log_entry(logbuffer,LVL_INFO);
13441350

13451351
if (args->av_vacuum_cost_delay!=-1)
13461352
sprintf(logbuffer," args->av_vacuum_cost_delay=%d",args->av_vacuum_cost_delay);
@@ -1646,8 +1652,8 @@ VacuumLoop(int argc, char **argv)
16461652
}
16471653
}
16481654

1649-
if (loops %UPDATE_INTERVAL==0)/* Update the list if it's
1650-
* time */
1655+
if (loops %args->update_interval==0)/* Update the list if it's
1656+
* time */
16511657
update_db_list(db_list);/* Add and remove databases from
16521658
* the list */
16531659

@@ -1661,8 +1667,8 @@ VacuumLoop(int argc, char **argv)
16611667

16621668
if (dbs->conn!=NULL)
16631669
{
1664-
if (loops %UPDATE_INTERVAL==0)/* Update the list if
1665-
* it's time */
1670+
if (loops %args->update_interval==0)/* Update the list if
1671+
* it's time */
16661672
update_table_list(dbs);/* Add and remove tables
16671673
* from the list */
16681674

‎contrib/pg_autovacuum/pg_autovacuum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Header file for pg_autovacuum.c
33
* (c) 2003 Matthew T. O'Connor
44
*
5-
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.14 2004/12/02 22:48:10 momjian Exp $
5+
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.15 2005/04/19 03:35:15 momjian Exp $
66
*/
77

88
#ifndef_PG_AUTOVACUUM_H
@@ -44,6 +44,7 @@ typedef struct cmdargs
4444
{
4545
intvacuum_base_threshold,
4646
analyze_base_threshold,
47+
update_interval,
4748
sleep_base_value,
4849
debug,
4950

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp