1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Just-in-time background writing strategy. This code avoids re-scanning

buffers that cannot possibly need to be cleaned, and estimates how many
buffers it should try to clean based on moving averages of recent allocation
requests and density of reusable buffers.  The patch also adds a couple
more columns to pg_stat_bgwriter to help measure the effectiveness of the
bgwriter.

Greg Smith, building on his own work and ideas from several other people,
in particular a much older patch from Itagaki Takahiro.
This commit is contained in:
Tom Lane
2007-09-25 20:03:38 +00:00
parent 588901df84
commit 6f5c38dcd0
16 changed files with 447 additions and 105 deletions

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.421 2007/09/24 03:12:23 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.422 2007/09/25 20:03:38 tgl Exp $
*
*--------------------------------------------------------------------
*/
@ -1574,7 +1574,7 @@ static struct config_int ConfigureNamesInt[] =
NULL
},
&bgwriter_lru_maxpages,
5, 0, 1000, NULL, NULL
100, 0, 1000, NULL, NULL
},
{
@ -1821,12 +1821,12 @@ static struct config_real ConfigureNamesReal[] =
},
{
{"bgwriter_lru_percent", PGC_SIGHUP, RESOURCES,
gettext_noop("Background writer percentage of LRU buffers to flush per round."),
{"bgwriter_lru_multiplier", PGC_SIGHUP, RESOURCES,
gettext_noop("Background writer multiplier on average buffers to scan per round."),
NULL
},
&bgwriter_lru_percent,
1.0, 0.0, 100.0, NULL, NULL
&bgwriter_lru_multiplier,
2.0, 0.0, 10.0, NULL, NULL
},
{