Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c969fed

Browse files
committed
Give VACUUM its own GUC parameter for memory usage, rather than
piggybacking on SortMem. Add documentation for some recently-added GUC parameters that had so far escaped it.
1 parent ae3129f commit c969fed

File tree

7 files changed

+97
-21
lines changed

7 files changed

+97
-21
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.81 2001/09/20 14:20:27 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.82 2001/09/21 03:32:35 tgl Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -780,6 +780,45 @@ env PGOPTIONS='-c geqo=off' psql
780780

781781
<para>
782782
<variablelist>
783+
<varlistentry>
784+
<term><varname>COLLECT_STARTCOLLECTOR</varname> (<type>boolean</type>)</term>
785+
<listitem>
786+
<para>
787+
Controls whether the postmaster should start the statistics-collection
788+
subprocess. This is on by default, but may be turned off if you
789+
know you have no interest in collecting statistics. This option
790+
can only be set at postmaster start.
791+
</para>
792+
</listitem>
793+
</varlistentry>
794+
795+
<varlistentry>
796+
<term><varname>COLLECT_RESETONPMSTART</varname> (<type>boolean</type>)</term>
797+
<listitem>
798+
<para>
799+
If on, collected statistics are zeroed out whenever the postmaster
800+
is restarted. If off, statistics are accumulated across postmaster
801+
restarts. The default is on. This option
802+
can only be set at postmaster start.
803+
</para>
804+
</listitem>
805+
</varlistentry>
806+
807+
<varlistentry>
808+
<term><varname>COLLECT_QUERYSTRING</varname> (<type>boolean</type>)</term>
809+
<term><varname>COLLECT_BLOCKLEVEL</varname> (<type>boolean</type>)</term>
810+
<term><varname>COLLECT_TUPLELEVEL</varname> (<type>boolean</type>)</term>
811+
<listitem>
812+
<para>
813+
These flags determine what information backends send to the statistics
814+
collector process: current queries, block-level activity statistics,
815+
or tuple-level activity statistics. All default to off. Enabling
816+
statistics collection costs a small amount of time per query, but
817+
is invaluable for debugging and performance tuning.
818+
</para>
819+
</listitem>
820+
</varlistentry>
821+
783822
<varlistentry>
784823
<term><varname>DEBUG_ASSERTIONS</varname> (<type>boolean</type>)</term>
785824
<listitem>
@@ -1013,7 +1052,7 @@ env PGOPTIONS='-c geqo=off' psql
10131052
<primary>transaction isolation level</primary>
10141053
</indexterm>
10151054

1016-
<term><varname>DEFAUL_TRANSACTION_ISOLATION</varname> (<type>string</type>)</term>
1055+
<term><varname>DEFAULT_TRANSACTION_ISOLATION</varname> (<type>string</type>)</term>
10171056
<listitem>
10181057
<para>
10191058
Each SQL transaction has an isolation level, which can be
@@ -1201,6 +1240,19 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
12011240
</listitem>
12021241
</varlistentry>
12031242

1243+
<varlistentry>
1244+
<term><varname>PASSWORD_ENCRYPTION</varname> (<type>boolean</type>)</term>
1245+
<listitem>
1246+
<para>
1247+
When a password is specified in <command>CREATE USER</> or
1248+
<command>ALTER USER</> without writing either ENCRYPTED or
1249+
UNENCRYPTED, this flag determines whether the password is encrypted.
1250+
The default is off (do not encrypt the password), but this choice
1251+
may change in a future release.
1252+
</para>
1253+
</listitem>
1254+
</varlistentry>
1255+
12041256
<varlistentry>
12051257
<term><varname>TRANSFORM_NULL_EQUALS</varname> (<type>boolean</type>)</term>
12061258
<listitem>
@@ -1285,7 +1337,7 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
12851337
<listitem>
12861338
<para>
12871339
Specifies the amount of memory to be used by internal sorts
1288-
and hashes before resorting to temporary disk files. The value
1340+
and hashes before switching to temporary disk files. The value
12891341
is specified in kilobytes, and defaults to 512 kilobytes. Note
12901342
that for a complex query, several sorts and/or hashes might be
12911343
running in parallel, and each one will be allowed to use as
@@ -1403,6 +1455,19 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
14031455
</listitem>
14041456
</varlistentry>
14051457

1458+
<varlistentry>
1459+
<term><varname>VACUUM_MEM</varname> (<type>integer</type>)</term>
1460+
<listitem>
1461+
<para>
1462+
Specifies the maximum amount of memory to be used by
1463+
<command>VACUUM</command> to keep track of to-be-reclaimed tuples.
1464+
The value is specified in kilobytes, and defaults to 8192 kilobytes.
1465+
Larger settings may improve the speed of vacuuming large tables
1466+
that have many deleted tuples.
1467+
</para>
1468+
</listitem>
1469+
</varlistentry>
1470+
14061471
<varlistentry>
14071472
<term><varname>VIRTUAL_HOST</varname> (<type>string</type>)</term>
14081473
<listitem>

src/backend/commands/vacuumlazy.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* relations with finite memory space usage. To do that, we set upper bounds
1111
* on the number of tuples and pages we will keep track of at once.
1212
*
13-
* We are willing to use at most SortMem memory space to keep track of
13+
* We are willing to use at most VacuumMem memory space to keep track of
1414
* dead tuples. We initially allocate an array of TIDs of that size.
1515
* If the array threatens to overflow, we suspend the heap scan phase
1616
* and perform a pass of index cleanup and page compaction, then resume
@@ -31,7 +31,7 @@
3131
*
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.6 2001/09/04 19:12:05 tgl Exp $
34+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.7 2001/09/21 03:32:35 tgl Exp $
3535
*
3636
*-------------------------------------------------------------------------
3737
*/
@@ -865,17 +865,15 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats)
865865
* lazy_space_alloc - space allocation decisions for lazy vacuum
866866
*
867867
* See the comments at the head of this file for rationale.
868-
*
869-
* XXX Should we have our own GUC parameter, instead of using SortMem?
870868
*/
871869
static void
872870
lazy_space_alloc(LVRelStats *vacrelstats, BlockNumber relblocks)
873871
{
874872
int maxtuples;
875873
int maxpages;
876874

877-
maxtuples = (int) ((SortMem * 1024L) / sizeof(ItemPointerData));
878-
/* stay sane if small SortMem */
875+
maxtuples = (int) ((VacuumMem * 1024L) / sizeof(ItemPointerData));
876+
/* stay sane if small VacuumMem */
879877
if (maxtuples < MAX_TUPLES_PER_PAGE)
880878
maxtuples = MAX_TUPLES_PER_PAGE;
881879

@@ -910,7 +908,7 @@ lazy_record_dead_tuple(LVRelStats *vacrelstats,
910908
{
911909
/*
912910
* The array shouldn't overflow under normal behavior,
913-
* but perhaps it could if we are given a really small SortMem.
911+
* but perhaps it could if we are given a really small VacuumMem.
914912
* In that case, just forget the last few tuples.
915913
*/
916914
if (vacrelstats->num_dead_tuples < vacrelstats->max_dead_tuples)

src/backend/utils/init/globals.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.59 2001/08/25 18:52:42 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.60 2001/09/21 03:32:35 tgl Exp $
1212
*
1313
* NOTES
1414
* Globals used all over the place should be declared here and not
@@ -82,6 +82,7 @@ char FloatFormat[20] = "%f";
8282
bool enableFsync = true;
8383
bool allowSystemTableMods = false;
8484
int SortMem = 512;
85+
int VacuumMem = 8192;
8586
int NBuffers = DEF_NBUFFERS;
8687

8788

src/backend/utils/misc/guc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Support for grand unified configuration scheme, including SET
55
* command, configuration file, and command line options.
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.49 2001/09/20 14:20:27 petere Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.50 2001/09/21 03:32:35 tgl Exp $
88
*
99
* Copyright 2000 by PostgreSQL Global Development Group
1010
* Written by Peter Eisentraut <[email protected]>.
@@ -176,12 +176,11 @@ struct config_string
176176
*
177177
* 4. Add a record below.
178178
*
179-
* 5. Add it to postgresql.conf.sample
179+
* 5. Add it to src/backend/utils/misc/postgresql.conf.sample.
180180
*
181-
* 6. Don't forget to document that option.
182-
*
183-
* WHEN MAKING MODIFICATIONS, remember to update postgresql.conf.sample
181+
* 6. Add it to src/bin/psql/tab-complete.c, if it's a USERSET option.
184182
*
183+
* 7. Don't forget to document the option.
185184
*/
186185

187186

@@ -298,6 +297,9 @@ static struct config_int
298297
{"sort_mem", PGC_USERSET, &SortMem,
299298
512, 4*BLCKSZ/1024, INT_MAX, NULL, NULL},
300299

300+
{"vacuum_mem", PGC_USERSET, &VacuumMem,
301+
8192, 1024, INT_MAX, NULL, NULL},
302+
301303
{"debug_level", PGC_USERSET, &DebugLvl,
302304
0, 0, 16, NULL, NULL},
303305

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
#
5454
# Performance
5555
#
56-
#sort_mem = 512
56+
#sort_mem = 512 # min 32
57+
#vacuum_mem = 8192 # min 1024
5758
#fsync = true
5859

5960

@@ -173,10 +174,11 @@
173174
#
174175
# Misc
175176
#
177+
#dynamic_library_path = '$libdir'
176178
#australian_timezones = false
177179
#deadlock_timeout = 1000
178180
#default_transaction_isolation = 'read committed'
179181
#max_expr_depth = 10000 # min 10
180182
#password_encryption = false
181183
#sql_inheritance = true
182-
184+
#transform_null_equals = false

src/bin/psql/tab-complete.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.37 2001/09/07 01:24:18 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.38 2001/09/21 03:32:36 tgl Exp $
77
*/
88

99
/*----------------------------------------------------------------------
@@ -226,8 +226,8 @@ psql_completion(char *text, int start, int end)
226226
"enable_nestloop",
227227
"enable_mergejoin",
228228
"enable_hashjoin",
229-
"geqo",
230229
"ksqo",
230+
"geqo",
231231
"fsync",
232232
"debug_assertions",
233233
"debug_print_query",
@@ -241,13 +241,17 @@ psql_completion(char *text, int start, int end)
241241
"show_query_stats",
242242
"trace_notify",
243243
"sql_inheritance",
244+
"australian_timezones",
245+
"password_encryption",
246+
"transform_null_equals",
244247

245248
"geqo_threshold",
246249
"geqo_pool_size",
247250
"geqo_effort",
248251
"geqo_generations",
249252
"geqo_random_seed",
250253
"sort_mem",
254+
"vacuum_mem",
251255
"debug_level",
252256
"max_expr_depth",
253257
"commit_delay",
@@ -259,6 +263,9 @@ psql_completion(char *text, int start, int end)
259263
"cpu_index_tuple_cost",
260264
"cpu_operator_cost",
261265
"geqo_selection_bias",
266+
267+
"default_transaction_isolation",
268+
262269
NULL
263270
};
264271

src/include/miscadmin.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: miscadmin.h,v 1.90 2001/09/08 15:24:00 petere Exp $
15+
* $Id: miscadmin.h,v 1.91 2001/09/21 03:32:36 tgl Exp $
1616
*
1717
* NOTES
1818
* some of the information in this file should be moved to
@@ -170,6 +170,7 @@ extern char DateFormat[];
170170
extern bool enableFsync;
171171
extern bool allowSystemTableMods;
172172
extern int SortMem;
173+
extern int VacuumMem;
173174

174175
/*
175176
* A few postmaster startup options are exported here so the

0 commit comments

Comments
 (0)