Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 640796f

Browse files
committed
Reduce the maximum value of vacuum_cost_delay and autovacuum_vacuum_cost_delay
to 100ms (from 1000). This still seems to be comfortably larger than the useful range of the parameter, and it should help discourage people from picking uselessly large values. Tweak the documentation to recommend small values, too. Per discussion of a couple weeks ago.
1 parent 07b9936 commit 640796f

File tree

6 files changed

+61
-53
lines changed

6 files changed

+61
-53
lines changed

doc/src/sgml/config.sgml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.210 2009/02/24 12:09:08 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.211 2009/02/28 00:10:50 tgl Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -1010,7 +1010,8 @@ SET ENABLE_SEQSCAN TO OFF;
10101010
</para>
10111011

10121012
<para>
1013-
This feature is disabled by default. To enable it, set the
1013+
This feature is disabled by default for manually issued
1014+
<command>VACUUM</command> commands. To enable it, set the
10141015
<varname>vacuum_cost_delay</varname> variable to a nonzero
10151016
value.
10161017
</para>
@@ -1033,6 +1034,13 @@ SET ENABLE_SEQSCAN TO OFF;
10331034
not a multiple of 10 might have the same results as setting it
10341035
to the next higher multiple of 10.
10351036
</para>
1037+
1038+
<para>
1039+
When using cost-based vacuuming, appropriate values for
1040+
<varname>vacuum_cost_delay</> are usually quite small, perhaps
1041+
10 or 20 milliseconds. Adjusting vacuum's resource consumption
1042+
is best done by changing the other vacuum cost parameters.
1043+
</para>
10361044
</listitem>
10371045
</varlistentry>
10381046

src/backend/access/common/reloptions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.21 2009/02/09 20:57:59 alvherre Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.22 2009/02/28 00:10:51 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -116,7 +116,7 @@ static relopt_int intRelOpts[] =
116116
"Vacuum cost delay in milliseconds, for autovacuum",
117117
RELOPT_KIND_HEAP
118118
},
119-
20, 0, 1000
119+
20, 0, 100
120120
},
121121
{
122122
{

src/backend/utils/misc/guc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.495 2009/01/21 09:28:26 mha Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.496 2009/02/28 00:10:51 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -1467,7 +1467,7 @@ static struct config_int ConfigureNamesInt[] =
14671467
GUC_UNIT_MS
14681468
},
14691469
&VacuumCostDelay,
1470-
0, 0, 1000, NULL, NULL
1470+
0, 0, 100, NULL, NULL
14711471
},
14721472

14731473
{
@@ -1477,7 +1477,7 @@ static struct config_int ConfigureNamesInt[] =
14771477
GUC_UNIT_MS
14781478
},
14791479
&autovacuum_vac_cost_delay,
1480-
20, -1, 1000, NULL, NULL
1480+
20, -1, 100, NULL, NULL
14811481
},
14821482

14831483
{

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119

120120
# - Cost-Based Vacuum Delay -
121121

122-
#vacuum_cost_delay = 0 # 0-1000 milliseconds
122+
#vacuum_cost_delay = 0 # 0-100 milliseconds
123123
#vacuum_cost_page_hit = 1 # 0-10000 credits
124124
#vacuum_cost_page_miss = 10 # 0-10000 credits
125125
#vacuum_cost_page_dirty = 20 # 0-10000 credits

src/test/regress/expected/guc.out

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ SHOW datestyle;
77
(1 row)
88

99
-- SET to some nondefault value
10-
SET vacuum_cost_delay TO 400;
10+
SET vacuum_cost_delay TO 40;
1111
SET datestyle = 'ISO, YMD';
1212
SHOW vacuum_cost_delay;
1313
vacuum_cost_delay
1414
-------------------
15-
400ms
15+
40ms
1616
(1 row)
1717

1818
SHOW datestyle;
@@ -28,11 +28,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
2828
(1 row)
2929

3030
-- SET LOCAL has no effect outside of a transaction
31-
SET LOCAL vacuum_cost_delay TO 500;
31+
SET LOCAL vacuum_cost_delay TO 50;
3232
SHOW vacuum_cost_delay;
3333
vacuum_cost_delay
3434
-------------------
35-
400ms
35+
40ms
3636
(1 row)
3737

3838
SET LOCAL datestyle = 'SQL';
@@ -50,11 +50,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
5050

5151
-- SET LOCAL within a transaction that commits
5252
BEGIN;
53-
SET LOCAL vacuum_cost_delay TO 500;
53+
SET LOCAL vacuum_cost_delay TO 50;
5454
SHOW vacuum_cost_delay;
5555
vacuum_cost_delay
5656
-------------------
57-
500ms
57+
50ms
5858
(1 row)
5959

6060
SET LOCAL datestyle = 'SQL';
@@ -74,7 +74,7 @@ COMMIT;
7474
SHOW vacuum_cost_delay;
7575
vacuum_cost_delay
7676
-------------------
77-
400ms
77+
40ms
7878
(1 row)
7979

8080
SHOW datestyle;
@@ -91,11 +91,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
9191

9292
-- SET should be reverted after ROLLBACK
9393
BEGIN;
94-
SET vacuum_cost_delay TO 600;
94+
SET vacuum_cost_delay TO 60;
9595
SHOW vacuum_cost_delay;
9696
vacuum_cost_delay
9797
-------------------
98-
600ms
98+
60ms
9999
(1 row)
100100

101101
SET datestyle = 'German';
@@ -115,7 +115,7 @@ ROLLBACK;
115115
SHOW vacuum_cost_delay;
116116
vacuum_cost_delay
117117
-------------------
118-
400ms
118+
40ms
119119
(1 row)
120120

121121
SHOW datestyle;
@@ -132,7 +132,7 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
132132

133133
-- Some tests with subtransactions
134134
BEGIN;
135-
SET vacuum_cost_delay TO 700;
135+
SET vacuum_cost_delay TO 70;
136136
SET datestyle = 'MDY';
137137
SHOW datestyle;
138138
DateStyle
@@ -147,11 +147,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
147147
(1 row)
148148

149149
SAVEPOINT first_sp;
150-
SET vacuum_cost_delay TO 800;
150+
SET vacuum_cost_delay TO 80;
151151
SHOW vacuum_cost_delay;
152152
vacuum_cost_delay
153153
-------------------
154-
800ms
154+
80ms
155155
(1 row)
156156

157157
SET datestyle = 'German, DMY';
@@ -181,7 +181,7 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
181181
(1 row)
182182

183183
SAVEPOINT second_sp;
184-
SET vacuum_cost_delay TO 900;
184+
SET vacuum_cost_delay TO 90;
185185
SET datestyle = 'SQL, YMD';
186186
SHOW datestyle;
187187
DateStyle
@@ -196,11 +196,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
196196
(1 row)
197197

198198
SAVEPOINT third_sp;
199-
SET vacuum_cost_delay TO 1000;
199+
SET vacuum_cost_delay TO 100;
200200
SHOW vacuum_cost_delay;
201201
vacuum_cost_delay
202202
-------------------
203-
1s
203+
100ms
204204
(1 row)
205205

206206
SET datestyle = 'Postgres, MDY';
@@ -220,7 +220,7 @@ ROLLBACK TO third_sp;
220220
SHOW vacuum_cost_delay;
221221
vacuum_cost_delay
222222
-------------------
223-
900ms
223+
90ms
224224
(1 row)
225225

226226
SHOW datestyle;
@@ -239,7 +239,7 @@ ROLLBACK TO second_sp;
239239
SHOW vacuum_cost_delay;
240240
vacuum_cost_delay
241241
-------------------
242-
700ms
242+
70ms
243243
(1 row)
244244

245245
SHOW datestyle;
@@ -258,7 +258,7 @@ ROLLBACK;
258258
SHOW vacuum_cost_delay;
259259
vacuum_cost_delay
260260
-------------------
261-
400ms
261+
40ms
262262
(1 row)
263263

264264
SHOW datestyle;
@@ -278,7 +278,7 @@ BEGIN;
278278
SHOW vacuum_cost_delay;
279279
vacuum_cost_delay
280280
-------------------
281-
400ms
281+
40ms
282282
(1 row)
283283

284284
SHOW datestyle;
@@ -294,11 +294,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
294294
(1 row)
295295

296296
SAVEPOINT sp;
297-
SET LOCAL vacuum_cost_delay TO 300;
297+
SET LOCAL vacuum_cost_delay TO 30;
298298
SHOW vacuum_cost_delay;
299299
vacuum_cost_delay
300300
-------------------
301-
300ms
301+
30ms
302302
(1 row)
303303

304304
SET LOCAL datestyle = 'Postgres, MDY';
@@ -318,7 +318,7 @@ ROLLBACK TO sp;
318318
SHOW vacuum_cost_delay;
319319
vacuum_cost_delay
320320
-------------------
321-
400ms
321+
40ms
322322
(1 row)
323323

324324
SHOW datestyle;
@@ -337,7 +337,7 @@ ROLLBACK;
337337
SHOW vacuum_cost_delay;
338338
vacuum_cost_delay
339339
-------------------
340-
400ms
340+
40ms
341341
(1 row)
342342

343343
SHOW datestyle;
@@ -357,7 +357,7 @@ BEGIN;
357357
SHOW vacuum_cost_delay;
358358
vacuum_cost_delay
359359
-------------------
360-
400ms
360+
40ms
361361
(1 row)
362362

363363
SHOW datestyle;
@@ -373,11 +373,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
373373
(1 row)
374374

375375
SAVEPOINT sp;
376-
SET LOCAL vacuum_cost_delay TO 300;
376+
SET LOCAL vacuum_cost_delay TO 30;
377377
SHOW vacuum_cost_delay;
378378
vacuum_cost_delay
379379
-------------------
380-
300ms
380+
30ms
381381
(1 row)
382382

383383
SET LOCAL datestyle = 'Postgres, MDY';
@@ -397,7 +397,7 @@ RELEASE SAVEPOINT sp;
397397
SHOW vacuum_cost_delay;
398398
vacuum_cost_delay
399399
-------------------
400-
300ms
400+
30ms
401401
(1 row)
402402

403403
SHOW datestyle;
@@ -416,7 +416,7 @@ ROLLBACK;
416416
SHOW vacuum_cost_delay;
417417
vacuum_cost_delay
418418
-------------------
419-
400ms
419+
40ms
420420
(1 row)
421421

422422
SHOW datestyle;
@@ -433,12 +433,12 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
433433

434434
-- SET followed by SET LOCAL
435435
BEGIN;
436-
SET vacuum_cost_delay TO 400;
437-
SET LOCAL vacuum_cost_delay TO 500;
436+
SET vacuum_cost_delay TO 40;
437+
SET LOCAL vacuum_cost_delay TO 50;
438438
SHOW vacuum_cost_delay;
439439
vacuum_cost_delay
440440
-------------------
441-
500ms
441+
50ms
442442
(1 row)
443443

444444
SET datestyle = 'ISO, DMY';
@@ -459,7 +459,7 @@ COMMIT;
459459
SHOW vacuum_cost_delay;
460460
vacuum_cost_delay
461461
-------------------
462-
400ms
462+
40ms
463463
(1 row)
464464

465465
SHOW datestyle;

0 commit comments

Comments
 (0)