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

Commite8f28cb

Browse files
committed
Dynamically set a lower bound on autovacuum nap time so that we don't rebuild
the database list too often.Per bug report from Łukasz Jagiełło and ensuing discussion onpgsql-performance.
1 parente5de601 commite8f28cb

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

‎src/backend/postmaster/autovacuum.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*
5656
*
5757
* IDENTIFICATION
58-
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.95 2009/05/15 15:56:39 tgl Exp $
58+
* $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.96 2009/06/09 16:41:02 alvherre Exp $
5959
*
6060
*-------------------------------------------------------------------------
6161
*/
@@ -123,6 +123,8 @@ intLog_autovacuum_min_duration = -1;
123123
/* how long to keep pgstat data in the launcher, in milliseconds */
124124
#defineSTATS_READ_DELAY 1000
125125

126+
/* the minimum allowed time between two awakening of the launcher */
127+
#defineMIN_AUTOVAC_SLEEPTIME 100.0/* milliseconds */
126128

127129
/* Flags to tell if we are in an autovacuum process */
128130
staticboolam_autovacuum_launcher= false;
@@ -822,11 +824,11 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
822824
return;
823825
}
824826

825-
/*100ms is thesmallest time we'll allow the launcher to sleep */
826-
if (nap->tv_sec <=0&&nap->tv_usec <=100000)
827+
/*Thesmallest time we'll allow the launcher to sleep. */
828+
if (nap->tv_sec <=0&&nap->tv_usec <=MIN_AUTOVAC_SLEEPTIME*1000)
827829
{
828830
nap->tv_sec=0;
829-
nap->tv_usec=100000;/* 100 ms */
831+
nap->tv_usec=MIN_AUTOVAC_SLEEPTIME*1000;
830832
}
831833
}
832834

@@ -997,8 +999,17 @@ rebuild_database_list(Oid newdb)
997999
/* sort the array */
9981000
qsort(dbary,nelems,sizeof(avl_dbase),db_comparator);
9991001

1000-
/* this is the time interval between databases in the schedule */
1002+
/*
1003+
* Determine the time interval between databases in the schedule.
1004+
* If we see that the configured naptime would take us to sleep times
1005+
* lower than our min sleep time (which launcher_determine_sleep is
1006+
* coded not to allow), silently use a larger naptime (but don't touch
1007+
* the GUC variable).
1008+
*/
10011009
millis_increment=1000.0*autovacuum_naptime /nelems;
1010+
if (millis_increment <=MIN_AUTOVAC_SLEEPTIME)
1011+
millis_increment=MIN_AUTOVAC_SLEEPTIME*1.1;
1012+
10021013
current_time=GetCurrentTimestamp();
10031014

10041015
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp