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

Commit 36a9cf3

Browse files
committed
Add --freeze option to vacuumdb.
1 parent 1d88d4e commit 36a9cf3

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

doc/src/sgml/ref/vacuumdb.sgml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.42 2007/12/11 19:57:32 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.43 2009/02/18 12:11:55 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -26,6 +26,7 @@ PostgreSQL documentation
2626
<group><arg>--full</arg><arg>-f</arg></group>
2727
<group><arg>--verbose</arg><arg>-v</arg></group>
2828
<group><arg>--analyze</arg><arg>-z</arg></group>
29+
<group><arg>--freeze</arg><arg>-F</arg></group>
2930
<arg>--table | -t <replaceable>table</replaceable>
3031
<arg>( <replaceable class="parameter">column</replaceable> [,...] )</arg>
3132
</arg>
@@ -37,6 +38,7 @@ PostgreSQL documentation
3738
<group><arg>--full</arg><arg>-f</arg></group>
3839
<group><arg>--verbose</arg><arg>-v</arg></group>
3940
<group><arg>--analyze</arg><arg>-z</arg></group>
41+
<group><arg>--freeze</arg><arg>-F</arg></group>
4042
</cmdsynopsis>
4143
</refsynopsisdiv>
4244

@@ -161,6 +163,16 @@ PostgreSQL documentation
161163
</para>
162164
</listitem>
163165
</varlistentry>
166+
167+
<varlistentry>
168+
<term><option>-F</option></term>
169+
<term><option>--freeze</option></term>
170+
<listitem>
171+
<para>
172+
Aggressively <quote>freeze</quote> tuples.
173+
</para>
174+
</listitem>
175+
</varlistentry>
164176
</variablelist>
165177
</para>
166178

src/bin/scripts/vacuumdb.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.22 2009/01/01 17:23:55 momjian Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.23 2009/02/18 12:11:55 momjian Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -15,11 +15,11 @@
1515

1616

1717
static void vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
18-
const char *table,
18+
bool freeze, const char *table,
1919
const char *host, const char *port,
2020
const char *username, bool password,
2121
const char *progname, bool echo);
22-
static void vacuum_all_databases(bool full, bool verbose, bool analyze,
22+
static void vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
2323
const char *host, const char *port,
2424
const char *username, bool password,
2525
const char *progname, bool echo, bool quiet);
@@ -39,6 +39,7 @@ main(int argc, char *argv[])
3939
{"quiet", no_argument, NULL, 'q'},
4040
{"dbname", required_argument, NULL, 'd'},
4141
{"analyze", no_argument, NULL, 'z'},
42+
{"freeze", no_argument, NULL, 'F'},
4243
{"all", no_argument, NULL, 'a'},
4344
{"table", required_argument, NULL, 't'},
4445
{"full", no_argument, NULL, 'f'},
@@ -58,6 +59,7 @@ main(int argc, char *argv[])
5859
bool echo = false;
5960
bool quiet = false;
6061
bool analyze = false;
62+
bool freeze = false;
6163
bool alldb = false;
6264
char *table = NULL;
6365
bool full = false;
@@ -68,7 +70,7 @@ main(int argc, char *argv[])
6870

6971
handle_help_version_opts(argc, argv, "vacuumdb", help);
7072

71-
while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zat:fv", long_options, &optindex)) != -1)
73+
while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zaFt:fv", long_options, &optindex)) != -1)
7274
{
7375
switch (c)
7476
{
@@ -96,6 +98,9 @@ main(int argc, char *argv[])
9698
case 'z':
9799
analyze = true;
98100
break;
101+
case 'F':
102+
freeze = true;
103+
break;
99104
case 'a':
100105
alldb = true;
101106
break;
@@ -145,7 +150,7 @@ main(int argc, char *argv[])
145150
exit(1);
146151
}
147152

148-
vacuum_all_databases(full, verbose, analyze,
153+
vacuum_all_databases(full, verbose, analyze, freeze,
149154
host, port, username, password,
150155
progname, echo, quiet);
151156
}
@@ -161,7 +166,7 @@ main(int argc, char *argv[])
161166
dbname = get_user_name(progname);
162167
}
163168

164-
vacuum_one_database(dbname, full, verbose, analyze, table,
169+
vacuum_one_database(dbname, full, verbose, analyze, freeze, table,
165170
host, port, username, password,
166171
progname, echo);
167172
}
@@ -172,7 +177,7 @@ main(int argc, char *argv[])
172177

173178
static void
174179
vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
175-
const char *table,
180+
bool freeze, const char *table,
176181
const char *host, const char *port,
177182
const char *username, bool password,
178183
const char *progname, bool echo)
@@ -190,6 +195,8 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
190195
appendPQExpBuffer(&sql, " VERBOSE");
191196
if (analyze)
192197
appendPQExpBuffer(&sql, " ANALYZE");
198+
if (freeze)
199+
appendPQExpBuffer(&sql, " FREEZE");
193200
if (table)
194201
appendPQExpBuffer(&sql, " %s", table);
195202
appendPQExpBuffer(&sql, ";\n");
@@ -212,7 +219,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
212219

213220

214221
static void
215-
vacuum_all_databases(bool full, bool verbose, bool analyze,
222+
vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
216223
const char *host, const char *port,
217224
const char *username, bool password,
218225
const char *progname, bool echo, bool quiet)
@@ -235,7 +242,7 @@ vacuum_all_databases(bool full, bool verbose, bool analyze,
235242
fflush(stdout);
236243
}
237244

238-
vacuum_one_database(dbname, full, verbose, analyze, NULL,
245+
vacuum_one_database(dbname, full, verbose, analyze, freeze, NULL,
239246
host, port, username, password,
240247
progname, echo);
241248
}
@@ -256,6 +263,7 @@ help(const char *progname)
256263
printf(_(" -t, --table='TABLE[(COLUMNS)]' vacuum specific table only\n"));
257264
printf(_(" -f, --full do full vacuuming\n"));
258265
printf(_(" -z, --analyze update optimizer hints\n"));
266+
printf(_(" -F, --freeze freeze row transaction information\n"));
259267
printf(_(" -e, --echo show the commands being sent to the server\n"));
260268
printf(_(" -q, --quiet don't write any messages\n"));
261269
printf(_(" -v, --verbose write a lot of output\n"));

0 commit comments

Comments
 (0)