Add --freeze option to vacuumdb.
authorBruce Momjian <[email protected]>
Wed, 18 Feb 2009 12:11:55 +0000 (12:11 +0000)
committerBruce Momjian <[email protected]>
Wed, 18 Feb 2009 12:11:55 +0000 (12:11 +0000)
doc/src/sgml/ref/vacuumdb.sgml
src/bin/scripts/vacuumdb.c

index 6a00946827415ecf32d8a95fd78aec27408ffb83..bd44f71c251f9c9668deb42b4d16f19f16fb099a 100644 (file)
@@ -26,6 +26,7 @@ PostgreSQL documentation
    <group><arg>--full</arg><arg>-f</arg></group>
    <group><arg>--verbose</arg><arg>-v</arg></group>
    <group><arg>--analyze</arg><arg>-z</arg></group>
+   <group><arg>--freeze</arg><arg>-F</arg></group>
    <arg>--table | -t <replaceable>table</replaceable>
     <arg>( <replaceable class="parameter">column</replaceable> [,...] )</arg>
    </arg>
@@ -37,6 +38,7 @@ PostgreSQL documentation
    <group><arg>--full</arg><arg>-f</arg></group>
    <group><arg>--verbose</arg><arg>-v</arg></group>
    <group><arg>--analyze</arg><arg>-z</arg></group>
+   <group><arg>--freeze</arg><arg>-F</arg></group>
   </cmdsynopsis>
  </refsynopsisdiv>
  
@@ -161,6 +163,16 @@ PostgreSQL documentation
        </para>
       </listitem>
      </varlistentry>
+
+     <varlistentry>
+      <term><option>-F</option></term>
+      <term><option>--freeze</option></term>
+      <listitem>
+       <para>
+        Aggressively <quote>freeze</quote> tuples.
+       </para>
+      </listitem>
+     </varlistentry>
     </variablelist>
    </para>
 
index c0f78a1e059da1e665904dd25b32720cd7f28c62..55f1f415ddf1bab3e4f41249cff2099bfbab8335 100644 (file)
 
 
 static void vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
-                                       const char *table,
+                                       bool freeze, const char *table,
                                        const char *host, const char *port,
                                        const char *username, bool password,
                                        const char *progname, bool echo);
-static void vacuum_all_databases(bool full, bool verbose, bool analyze,
+static void vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
                                         const char *host, const char *port,
                                         const char *username, bool password,
                                         const char *progname, bool echo, bool quiet);
@@ -39,6 +39,7 @@ main(int argc, char *argv[])
                {"quiet", no_argument, NULL, 'q'},
                {"dbname", required_argument, NULL, 'd'},
                {"analyze", no_argument, NULL, 'z'},
+               {"freeze", no_argument, NULL, 'F'},
                {"all", no_argument, NULL, 'a'},
                {"table", required_argument, NULL, 't'},
                {"full", no_argument, NULL, 'f'},
@@ -58,6 +59,7 @@ main(int argc, char *argv[])
        bool            echo = false;
        bool            quiet = false;
        bool            analyze = false;
+       bool            freeze = false;
        bool            alldb = false;
        char       *table = NULL;
        bool            full = false;
@@ -68,7 +70,7 @@ main(int argc, char *argv[])
 
        handle_help_version_opts(argc, argv, "vacuumdb", help);
 
-       while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zat:fv", long_options, &optindex)) != -1)
+       while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zaFt:fv", long_options, &optindex)) != -1)
        {
                switch (c)
                {
@@ -96,6 +98,9 @@ main(int argc, char *argv[])
                        case 'z':
                                analyze = true;
                                break;
+                       case 'F':
+                               freeze = true;
+                               break;
                        case 'a':
                                alldb = true;
                                break;
@@ -145,7 +150,7 @@ main(int argc, char *argv[])
                        exit(1);
                }
 
-               vacuum_all_databases(full, verbose, analyze,
+               vacuum_all_databases(full, verbose, analyze, freeze,
                                                         host, port, username, password,
                                                         progname, echo, quiet);
        }
@@ -161,7 +166,7 @@ main(int argc, char *argv[])
                                dbname = get_user_name(progname);
                }
 
-               vacuum_one_database(dbname, full, verbose, analyze, table,
+               vacuum_one_database(dbname, full, verbose, analyze, freeze, table,
                                                        host, port, username, password,
                                                        progname, echo);
        }
@@ -172,7 +177,7 @@ main(int argc, char *argv[])
 
 static void
 vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
-                                       const char *table,
+                                       bool freeze, const char *table,
                                        const char *host, const char *port,
                                        const char *username, bool password,
                                        const char *progname, bool echo)
@@ -190,6 +195,8 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
                appendPQExpBuffer(&sql, " VERBOSE");
        if (analyze)
                appendPQExpBuffer(&sql, " ANALYZE");
+       if (freeze)
+               appendPQExpBuffer(&sql, " FREEZE");
        if (table)
                appendPQExpBuffer(&sql, " %s", table);
        appendPQExpBuffer(&sql, ";\n");
@@ -212,7 +219,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
 
 
 static void
-vacuum_all_databases(bool full, bool verbose, bool analyze,
+vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
                                         const char *host, const char *port,
                                         const char *username, bool password,
                                         const char *progname, bool echo, bool quiet)
@@ -235,7 +242,7 @@ vacuum_all_databases(bool full, bool verbose, bool analyze,
                        fflush(stdout);
                }
 
-               vacuum_one_database(dbname, full, verbose, analyze, NULL,
+               vacuum_one_database(dbname, full, verbose, analyze, freeze, NULL,
                                                        host, port, username, password,
                                                        progname, echo);
        }
@@ -256,6 +263,7 @@ help(const char *progname)
        printf(_("  -t, --table='TABLE[(COLUMNS)]'  vacuum specific table only\n"));
        printf(_("  -f, --full                      do full vacuuming\n"));
        printf(_("  -z, --analyze                   update optimizer hints\n"));
+       printf(_("  -F, --freeze                    freeze row transaction information\n"));
        printf(_("  -e, --echo                      show the commands being sent to the server\n"));
        printf(_("  -q, --quiet                     don't write any messages\n"));
        printf(_("  -v, --verbose                   write a lot of output\n"));