LCOV - differential code coverage report
Current view: top level - src/bin/scripts - vacuumdb.c (source / functions) Coverage Total Hit UNC UBC GIC GNC CBC DUB DCB
Current: 7a15cff1f11193467898da1c1fabf06fd2caee04 vs 84a3778c79c2d28b4dc281d03ef2ab019b16483b Lines: 86.0 % 235 202 3 30 34 168 75 279
Current Date: 2025-12-15 18:36:29 -0500 Functions: 100.0 % 3 3 3 1 6
Baseline: lcov-20251216-010103-baseline Branches: 78.4 % 116 91 5 20 1 17 73
Baseline Date: 2025-12-15 13:30:48 -0800 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(1,7] days: 87.5 % 8 7 1 7
(30,360] days: 91.2 % 34 31 2 1 27 4
(360..) days: 85.0 % 193 164 29 164
Function coverage date bins:
(30,360] days: 100.0 % 1 1 1
(360..) days: 100.0 % 2 2 2
Branch coverage date bins:
(1,7] days: 75.0 % 4 3 1 3
(30,360] days: 77.8 % 18 14 4 14
(360..) days: 78.7 % 94 74 20 1 73

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : /*-------------------------------------------------------------------------
                                  2                 :                :  *
                                  3                 :                :  * vacuumdb
                                  4                 :                :  *
                                  5                 :                :  * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
                                  6                 :                :  * Portions Copyright (c) 1994, Regents of the University of California
                                  7                 :                :  *
                                  8                 :                :  * src/bin/scripts/vacuumdb.c
                                  9                 :                :  *
                                 10                 :                :  *-------------------------------------------------------------------------
                                 11                 :                :  */
                                 12                 :                : 
                                 13                 :                : #include "postgres_fe.h"
                                 14                 :                : 
                                 15                 :                : #include <limits.h>
                                 16                 :                : 
                                 17                 :                : #include "common.h"
                                 18                 :                : #include "common/logging.h"
                                 19                 :                : #include "fe_utils/option_utils.h"
                                 20                 :                : #include "vacuuming.h"
                                 21                 :                : 
                                 22                 :                : static void help(const char *progname);
                                 23                 :                : static void check_objfilter(bits32 objfilter);
                                 24                 :                : 
                                 25                 :                : 
                                 26                 :                : int
 8217 peter_e@gmx.net            27                 :CBC         103 : main(int argc, char *argv[])
                                 28                 :                : {
                                 29                 :                :     static struct option long_options[] = {
                                 30                 :                :         {"host", required_argument, NULL, 'h'},
                                 31                 :                :         {"port", required_argument, NULL, 'p'},
                                 32                 :                :         {"username", required_argument, NULL, 'U'},
                                 33                 :                :         {"no-password", no_argument, NULL, 'w'},
                                 34                 :                :         {"password", no_argument, NULL, 'W'},
                                 35                 :                :         {"echo", no_argument, NULL, 'e'},
                                 36                 :                :         {"quiet", no_argument, NULL, 'q'},
                                 37                 :                :         {"dbname", required_argument, NULL, 'd'},
                                 38                 :                :         {"analyze", no_argument, NULL, 'z'},
                                 39                 :                :         {"analyze-only", no_argument, NULL, 'Z'},
                                 40                 :                :         {"freeze", no_argument, NULL, 'F'},
                                 41                 :                :         {"all", no_argument, NULL, 'a'},
                                 42                 :                :         {"table", required_argument, NULL, 't'},
                                 43                 :                :         {"full", no_argument, NULL, 'f'},
                                 44                 :                :         {"verbose", no_argument, NULL, 'v'},
                                 45                 :                :         {"jobs", required_argument, NULL, 'j'},
                                 46                 :                :         {"parallel", required_argument, NULL, 'P'},
                                 47                 :                :         {"schema", required_argument, NULL, 'n'},
                                 48                 :                :         {"exclude-schema", required_argument, NULL, 'N'},
                                 49                 :                :         {"maintenance-db", required_argument, NULL, 2},
                                 50                 :                :         {"analyze-in-stages", no_argument, NULL, 3},
                                 51                 :                :         {"disable-page-skipping", no_argument, NULL, 4},
                                 52                 :                :         {"skip-locked", no_argument, NULL, 5},
                                 53                 :                :         {"min-xid-age", required_argument, NULL, 6},
                                 54                 :                :         {"min-mxid-age", required_argument, NULL, 7},
                                 55                 :                :         {"no-index-cleanup", no_argument, NULL, 8},
                                 56                 :                :         {"force-index-cleanup", no_argument, NULL, 9},
                                 57                 :                :         {"no-truncate", no_argument, NULL, 10},
                                 58                 :                :         {"no-process-toast", no_argument, NULL, 11},
                                 59                 :                :         {"no-process-main", no_argument, NULL, 12},
                                 60                 :                :         {"buffer-usage-limit", required_argument, NULL, 13},
                                 61                 :                :         {"missing-stats-only", no_argument, NULL, 14},
                                 62                 :                :         {"dry-run", no_argument, NULL, 15},
                                 63                 :                :         {NULL, 0, NULL, 0}
                                 64                 :                :     };
                                 65                 :                : 
                                 66                 :                :     const char *progname;
                                 67                 :                :     int         optindex;
                                 68                 :                :     int         c;
                                 69                 :            103 :     const char *dbname = NULL;
 5124 rhaas@postgresql.org       70                 :            103 :     const char *maintenance_db = NULL;
                                 71                 :                :     ConnParams  cparams;
                                 72                 :                :     vacuumingOptions vacopts;
 1234 andrew@dunslane.net        73                 :            103 :     SimpleStringList objects = {NULL, NULL};
 3980 alvherre@alvh.no-ip.       74                 :            103 :     int         concurrentCons = 1;
   81 alvherre@kurilemu.de       75                 :GNC         103 :     unsigned int tbl_count = 0;
                                 76                 :                :     int         ret;
                                 77                 :                : 
                                 78                 :                :     /* initialize options */
 3980 alvherre@alvh.no-ip.       79                 :CBC         103 :     memset(&vacopts, 0, sizeof(vacopts));
 2148 akapila@postgresql.o       80                 :            103 :     vacopts.parallel_workers = -1;
 2003 michael@paquier.xyz        81                 :            103 :     vacopts.do_truncate = true;
 1016                            82                 :            103 :     vacopts.process_main = true;
 1771                            83                 :            103 :     vacopts.process_toast = true;
                                 84                 :                : 
                                 85                 :                :     /* the same for connection parameters */
   81 alvherre@kurilemu.de       86                 :GNC         103 :     memset(&cparams, 0, sizeof(cparams));
                                 87                 :            103 :     cparams.prompt_password = TRI_DEFAULT;
                                 88                 :                : 
 2451 peter@eisentraut.org       89                 :CBC         103 :     pg_logging_init(argv[0]);
 8217 peter_e@gmx.net            90                 :            103 :     progname = get_progname(argv[0]);
 6214                            91                 :            103 :     set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
                                 92                 :                : 
 8217                            93                 :            103 :     handle_help_version_opts(argc, argv, "vacuumdb", help);
                                 94                 :                : 
   81 alvherre@kurilemu.de       95                 :GNC         287 :     while ((c = getopt_long(argc, argv, "ad:efFh:j:n:N:p:P:qt:U:vwWzZ",
                                 96         [ +  + ]:            287 :                             long_options, &optindex)) != -1)
                                 97                 :                :     {
 8217 peter_e@gmx.net            98   [ +  +  +  +  :CBC         208 :         switch (c)
                                     +  +  +  +  +  
                                     +  +  -  +  +  
                                     -  -  -  +  +  
                                     -  +  +  +  +  
                                     +  +  -  +  +  
                                        +  -  +  +  
                                                 + ]
                                 99                 :                :         {
 1100 peter@eisentraut.org      100                 :             27 :             case 'a':
   81 alvherre@kurilemu.de      101                 :GNC          27 :                 vacopts.objfilter |= OBJFILTER_ALL_DBS;
 8217 peter_e@gmx.net           102                 :CBC          27 :                 break;
                                103                 :              2 :             case 'd':
   81 alvherre@kurilemu.de      104                 :GNC           2 :                 vacopts.objfilter |= OBJFILTER_DATABASE;
 4813 bruce@momjian.us          105                 :CBC           2 :                 dbname = pg_strdup(optarg);
 8217 peter_e@gmx.net           106                 :              2 :                 break;
 1100 peter@eisentraut.org      107                 :              1 :             case 'e':
    7 nathan@postgresql.or      108                 :GNC           1 :                 vacopts.echo = true;
 5823 bruce@momjian.us          109                 :CBC           1 :                 break;
 1100 peter@eisentraut.org      110                 :              1 :             case 'f':
                                111                 :              1 :                 vacopts.full = true;
 8217 peter_e@gmx.net           112                 :              1 :                 break;
 6145 bruce@momjian.us          113                 :             10 :             case 'F':
 3980 alvherre@alvh.no-ip.      114                 :             10 :                 vacopts.freeze = true;
 6145 bruce@momjian.us          115                 :             10 :                 break;
 1100 peter@eisentraut.org      116                 :             18 :             case 'h':
   81 alvherre@kurilemu.de      117                 :GNC          18 :                 cparams.pghost = pg_strdup(optarg);
 3980 alvherre@alvh.no-ip.      118                 :CBC          18 :                 break;
                                119                 :              1 :             case 'j':
 1606 michael@paquier.xyz       120         [ -  + ]:              1 :                 if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
                                121                 :                :                                       &concurrentCons))
 3980 alvherre@alvh.no-ip.      122                 :UBC           0 :                     exit(1);
 8217 peter_e@gmx.net           123                 :CBC           1 :                 break;
 1100 peter@eisentraut.org      124                 :              7 :             case 'n':
   81 alvherre@kurilemu.de      125                 :GNC           7 :                 vacopts.objfilter |= OBJFILTER_SCHEMA;
 1100 peter@eisentraut.org      126                 :CBC           7 :                 simple_string_list_append(&objects, optarg);
                                127                 :              7 :                 break;
                                128                 :              6 :             case 'N':
   81 alvherre@kurilemu.de      129                 :GNC           6 :                 vacopts.objfilter |= OBJFILTER_SCHEMA_EXCLUDE;
 1100 peter@eisentraut.org      130                 :CBC           6 :                 simple_string_list_append(&objects, optarg);
                                131                 :              6 :                 break;
                                132                 :             18 :             case 'p':
   81 alvherre@kurilemu.de      133                 :GNC          18 :                 cparams.pgport = pg_strdup(optarg);
 1100 peter@eisentraut.org      134                 :CBC          18 :                 break;
 2148 akapila@postgresql.o      135                 :              3 :             case 'P':
 1606 michael@paquier.xyz       136         [ +  + ]:              3 :                 if (!option_parse_int(optarg, "-P/--parallel", 0, INT_MAX,
                                137                 :                :                                       &vacopts.parallel_workers))
 2148 akapila@postgresql.o      138                 :              1 :                     exit(1);
                                139                 :              2 :                 break;
 1100 peter@eisentraut.org      140                 :UBC           0 :             case 'q':
    7 nathan@postgresql.or      141                 :UNC           0 :                 vacopts.quiet = true;
 1100 peter@eisentraut.org      142                 :UBC           0 :                 break;
 1100 peter@eisentraut.org      143                 :CBC          25 :             case 't':
   81 alvherre@kurilemu.de      144                 :GNC          25 :                 vacopts.objfilter |= OBJFILTER_TABLE;
 1100 peter@eisentraut.org      145                 :CBC          25 :                 simple_string_list_append(&objects, optarg);
                                146                 :             25 :                 tbl_count++;
                                147                 :             25 :                 break;
                                148                 :             18 :             case 'U':
   81 alvherre@kurilemu.de      149                 :GNC          18 :                 cparams.pguser = pg_strdup(optarg);
 1100 peter@eisentraut.org      150                 :CBC          18 :                 break;
 1100 peter@eisentraut.org      151                 :UBC           0 :             case 'v':
                                152                 :              0 :                 vacopts.verbose = true;
                                153                 :              0 :                 break;
                                154                 :              0 :             case 'w':
   81 alvherre@kurilemu.de      155                 :UNC           0 :                 cparams.prompt_password = TRI_NO;
 1100 peter@eisentraut.org      156                 :UBC           0 :                 break;
                                157                 :              0 :             case 'W':
   81 alvherre@kurilemu.de      158                 :UNC           0 :                 cparams.prompt_password = TRI_YES;
 1100 peter@eisentraut.org      159                 :UBC           0 :                 break;
 1100 peter@eisentraut.org      160                 :CBC          13 :             case 'z':
                                161                 :             13 :                 vacopts.and_analyze = true;
                                162                 :             13 :                 break;
                                163                 :             22 :             case 'Z':
                                164                 :                :                 /* if analyze-in-stages is given, don't override it */
   81 alvherre@kurilemu.de      165         [ +  - ]:GNC          22 :                 if (vacopts.mode != MODE_ANALYZE_IN_STAGES)
                                166                 :             22 :                     vacopts.mode = MODE_ANALYZE;
 1100 peter@eisentraut.org      167                 :CBC          22 :                 break;
 5124 rhaas@postgresql.org      168                 :UBC           0 :             case 2:
 4813 bruce@momjian.us          169                 :              0 :                 maintenance_db = pg_strdup(optarg);
 5124 rhaas@postgresql.org      170                 :              0 :                 break;
 4264 peter_e@gmx.net           171                 :CBC           6 :             case 3:
   81 alvherre@kurilemu.de      172                 :GNC           6 :                 vacopts.mode = MODE_ANALYZE_IN_STAGES;
 4264 peter_e@gmx.net           173                 :CBC           6 :                 break;
 2534 michael@paquier.xyz       174                 :              2 :             case 4:
                                175                 :              2 :                 vacopts.disable_page_skipping = true;
                                176                 :              2 :                 break;
                                177                 :              2 :             case 5:
                                178                 :              2 :                 vacopts.skip_locked = true;
                                179                 :              2 :                 break;
 2511                           180                 :              2 :             case 6:
 1606                           181         [ +  + ]:              2 :                 if (!option_parse_int(optarg, "--min-xid-age", 1, INT_MAX,
                                182                 :                :                                       &vacopts.min_xid_age))
 2511                           183                 :              1 :                     exit(1);
                                184                 :              1 :                 break;
                                185                 :              2 :             case 7:
 1606                           186         [ +  + ]:              2 :                 if (!option_parse_int(optarg, "--min-mxid-age", 1, INT_MAX,
                                187                 :                :                                       &vacopts.min_mxid_age))
 2511                           188                 :              1 :                     exit(1);
                                189                 :              1 :                 break;
 2003                           190                 :              2 :             case 8:
 1642 pg@bowt.ie                191                 :              2 :                 vacopts.no_index_cleanup = true;
 2003 michael@paquier.xyz       192                 :              2 :                 break;
 2003 michael@paquier.xyz       193                 :UBC           0 :             case 9:
 1642 pg@bowt.ie                194                 :              0 :                 vacopts.force_index_cleanup = true;
 2003 michael@paquier.xyz       195                 :              0 :                 break;
 1771 michael@paquier.xyz       196                 :CBC           2 :             case 10:
 1642 pg@bowt.ie                197                 :              2 :                 vacopts.do_truncate = false;
                                198                 :              2 :                 break;
                                199                 :              2 :             case 11:
 1771 michael@paquier.xyz       200                 :              2 :                 vacopts.process_toast = false;
                                201                 :              2 :                 break;
 1016                           202                 :              2 :             case 12:
                                203                 :              2 :                 vacopts.process_main = false;
                                204                 :              2 :                 break;
  984 drowley@postgresql.o      205                 :UBC           0 :             case 13:
  817                           206                 :              0 :                 vacopts.buffer_usage_limit = escape_quotes(optarg);
  984                           207                 :              0 :                 break;
  273 nathan@postgresql.or      208                 :CBC          11 :             case 14:
                                209                 :             11 :                 vacopts.missing_stats_only = true;
                                210                 :             11 :                 break;
    7 nathan@postgresql.or      211                 :GNC           2 :             case 15:
                                212                 :              2 :                 vacopts.dry_run = true;
                                213                 :              2 :                 break;
 8217 peter_e@gmx.net           214                 :CBC           1 :             default:
                                215                 :                :                 /* getopt_long already emitted a complaint */
 1348 tgl@sss.pgh.pa.us         216                 :              1 :                 pg_log_error_hint("Try \"%s --help\" for more information.", progname);
 8217 peter_e@gmx.net           217                 :              1 :                 exit(1);
                                218                 :                :         }
                                219                 :                :     }
                                220                 :                : 
                                221                 :                :     /*
                                222                 :                :      * Non-option argument specifies database name as long as it wasn't
                                223                 :                :      * already specified with -d / --dbname
                                224                 :                :      */
 4991 andrew@dunslane.net       225   [ +  +  +  - ]:             79 :     if (optind < argc && dbname == NULL)
                                226                 :                :     {
   81 alvherre@kurilemu.de      227                 :GNC          52 :         vacopts.objfilter |= OBJFILTER_DATABASE;
 4991 andrew@dunslane.net       228                 :CBC          52 :         dbname = argv[optind];
                                229                 :             52 :         optind++;
                                230                 :                :     }
                                231                 :                : 
                                232         [ -  + ]:             79 :     if (optind < argc)
                                233                 :                :     {
 2451 peter@eisentraut.org      234                 :UBC           0 :         pg_log_error("too many command-line arguments (first is \"%s\")",
                                235                 :                :                      argv[optind]);
 1348 tgl@sss.pgh.pa.us         236                 :              0 :         pg_log_error_hint("Try \"%s --help\" for more information.", progname);
 4991 andrew@dunslane.net       237                 :              0 :         exit(1);
                                238                 :                :     }
                                239                 :                : 
                                240                 :                :     /*
                                241                 :                :      * Validate the combination of filters specified in the command-line
                                242                 :                :      * options.
                                243                 :                :      */
   81 alvherre@kurilemu.de      244                 :GNC          79 :     check_objfilter(vacopts.objfilter);
                                245                 :                : 
                                246         [ +  + ]:             74 :     if (vacopts.mode == MODE_ANALYZE ||
                                247         [ +  + ]:             52 :         vacopts.mode == MODE_ANALYZE_IN_STAGES)
                                248                 :                :     {
 3980 alvherre@alvh.no-ip.      249         [ -  + ]:CBC          28 :         if (vacopts.full)
 1348 tgl@sss.pgh.pa.us         250                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                251                 :                :                      "full");
 3980 alvherre@alvh.no-ip.      252         [ -  + ]:CBC          28 :         if (vacopts.freeze)
 1348 tgl@sss.pgh.pa.us         253                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                254                 :                :                      "freeze");
 2534 michael@paquier.xyz       255         [ +  + ]:CBC          28 :         if (vacopts.disable_page_skipping)
 1348 tgl@sss.pgh.pa.us         256                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                257                 :                :                      "disable-page-skipping");
 1642 pg@bowt.ie                258         [ +  + ]:             27 :         if (vacopts.no_index_cleanup)
 1348 tgl@sss.pgh.pa.us         259                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                260                 :                :                      "no-index-cleanup");
 1642 pg@bowt.ie                261         [ -  + ]:             26 :         if (vacopts.force_index_cleanup)
 1348 tgl@sss.pgh.pa.us         262                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                263                 :                :                      "force-index-cleanup");
 2003 michael@paquier.xyz       264         [ +  + ]:CBC          26 :         if (!vacopts.do_truncate)
 1348 tgl@sss.pgh.pa.us         265                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                266                 :                :                      "no-truncate");
 1016 michael@paquier.xyz       267         [ +  + ]:             25 :         if (!vacopts.process_main)
                                268                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                269                 :                :                      "no-process-main");
 1771                           270         [ +  + ]:             24 :         if (!vacopts.process_toast)
 1348 tgl@sss.pgh.pa.us         271                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                272                 :                :                      "no-process-toast");
                                273                 :                :         /* allow 'and_analyze' with 'analyze_only' */
                                274                 :                :     }
                                275                 :                : 
                                276                 :                :     /* Prohibit full and analyze_only options with parallel option */
 2148 akapila@postgresql.o      277         [ +  + ]:             69 :     if (vacopts.parallel_workers >= 0)
                                278                 :                :     {
   81 alvherre@kurilemu.de      279         [ +  - ]:GNC           2 :         if (vacopts.mode == MODE_ANALYZE ||
                                280         [ -  + ]:              2 :             vacopts.mode == MODE_ANALYZE_IN_STAGES)
 1348 tgl@sss.pgh.pa.us         281                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                282                 :                :                      "parallel");
 2148 akapila@postgresql.o      283         [ -  + ]:CBC           2 :         if (vacopts.full)
 1348 tgl@sss.pgh.pa.us         284                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing full vacuum",
                                285                 :                :                      "parallel");
                                286                 :                :     }
                                287                 :                : 
                                288                 :                :     /* Prohibit --no-index-cleanup and --force-index-cleanup together */
 1642 pg@bowt.ie                289   [ +  +  -  + ]:CBC          69 :     if (vacopts.no_index_cleanup && vacopts.force_index_cleanup)
 1348 tgl@sss.pgh.pa.us         290                 :UBC           0 :         pg_fatal("cannot use the \"%s\" option with the \"%s\" option",
                                291                 :                :                  "no-index-cleanup", "force-index-cleanup");
                                292                 :                : 
                                293                 :                :     /*
                                294                 :                :      * buffer-usage-limit is not allowed with VACUUM FULL unless ANALYZE is
                                295                 :                :      * included too.
                                296                 :                :      */
  984 drowley@postgresql.o      297   [ -  +  -  -  :CBC          69 :     if (vacopts.buffer_usage_limit && vacopts.full && !vacopts.and_analyze)
                                              -  - ]
  984 drowley@postgresql.o      298                 :UBC           0 :         pg_fatal("cannot use the \"%s\" option with the \"%s\" option",
                                299                 :                :                  "buffer-usage-limit", "full");
                                300                 :                : 
                                301                 :                :     /*
                                302                 :                :      * Prohibit --missing-stats-only without --analyze-only or
                                303                 :                :      * --analyze-in-stages.
                                304                 :                :      */
   81 alvherre@kurilemu.de      305   [ +  +  +  + ]:GNC          69 :     if (vacopts.missing_stats_only && (vacopts.mode != MODE_ANALYZE &&
                                306         [ -  + ]:              4 :                                        vacopts.mode != MODE_ANALYZE_IN_STAGES))
  273 nathan@postgresql.or      307                 :UBC           0 :         pg_fatal("cannot use the \"%s\" option without \"%s\" or \"%s\"",
                                308                 :                :                  "missing-stats-only", "analyze-only", "analyze-in-stages");
                                309                 :                : 
    7 nathan@postgresql.or      310   [ +  +  +  - ]:GNC          69 :     if (vacopts.dry_run && !vacopts.quiet)
                                311                 :              2 :         pg_log_info("Executing in dry-run mode.\n"
                                312                 :                :                     "No commands will be sent to the server.");
                                313                 :                : 
   81 alvherre@kurilemu.de      314                 :             69 :     ret = vacuuming_main(&cparams, dbname, maintenance_db, &vacopts,
                                315                 :                :                          &objects, tbl_count,
                                316                 :                :                          concurrentCons,
                                317                 :                :                          progname);
                                318                 :             67 :     exit(ret);
                                319                 :                : }
                                320                 :                : 
                                321                 :                : /*
                                322                 :                :  * Verify that the filters used at command line are compatible.
                                323                 :                :  */
                                324                 :                : void
                                325                 :             79 : check_objfilter(bits32 objfilter)
                                326                 :                : {
 1234 andrew@dunslane.net       327         [ +  + ]:CBC          79 :     if ((objfilter & OBJFILTER_ALL_DBS) &&
                                328         [ +  + ]:             27 :         (objfilter & OBJFILTER_DATABASE))
                                329                 :              2 :         pg_fatal("cannot vacuum all databases and a specific one at the same time");
                                330                 :                : 
                                331         [ +  + ]:             77 :     if ((objfilter & OBJFILTER_TABLE) &&
                                332         [ +  + ]:             23 :         (objfilter & OBJFILTER_SCHEMA))
                                333                 :              1 :         pg_fatal("cannot vacuum all tables in schema(s) and specific table(s) at the same time");
                                334                 :                : 
                                335         [ +  + ]:             76 :     if ((objfilter & OBJFILTER_TABLE) &&
                                336         [ +  + ]:             22 :         (objfilter & OBJFILTER_SCHEMA_EXCLUDE))
                                337                 :              1 :         pg_fatal("cannot vacuum specific table(s) and exclude schema(s) at the same time");
                                338                 :                : 
                                339         [ +  + ]:             75 :     if ((objfilter & OBJFILTER_SCHEMA) &&
                                340         [ +  + ]:              5 :         (objfilter & OBJFILTER_SCHEMA_EXCLUDE))
                                341                 :              1 :         pg_fatal("cannot vacuum all tables in schema(s) and exclude schema(s) at the same time");
                                342                 :             74 : }
                                343                 :                : 
                                344                 :                : 
                                345                 :                : static void
 8217 peter_e@gmx.net           346                 :              1 : help(const char *progname)
                                347                 :                : {
                                348                 :              1 :     printf(_("%s cleans and analyzes a PostgreSQL database.\n\n"), progname);
                                349                 :              1 :     printf(_("Usage:\n"));
                                350                 :              1 :     printf(_("  %s [OPTION]... [DBNAME]\n"), progname);
                                351                 :              1 :     printf(_("\nOptions:\n"));
                                352                 :              1 :     printf(_("  -a, --all                       vacuum all databases\n"));
  975 drowley@postgresql.o      353                 :              1 :     printf(_("      --buffer-usage-limit=SIZE   size of ring buffer used for vacuum\n"));
 8217 peter_e@gmx.net           354                 :              1 :     printf(_("  -d, --dbname=DBNAME             database to vacuum\n"));
 2534 michael@paquier.xyz       355                 :              1 :     printf(_("      --disable-page-skipping     disable all page-skipping behavior\n"));
    7 nathan@postgresql.or      356                 :GNC           1 :     printf(_("      --dry-run                   show the commands that would be sent to the server\n"));
 6138 peter_e@gmx.net           357                 :CBC           1 :     printf(_("  -e, --echo                      show the commands being sent to the server\n"));
 8217                           358                 :              1 :     printf(_("  -f, --full                      do full vacuuming\n"));
 6145 bruce@momjian.us          359                 :              1 :     printf(_("  -F, --freeze                    freeze row transaction information\n"));
 1635 peter@eisentraut.org      360                 :              1 :     printf(_("      --force-index-cleanup       always remove index entries that point to dead tuples\n"));
 3744 peter_e@gmx.net           361                 :              1 :     printf(_("  -j, --jobs=NUM                  use this many concurrent connections to vacuum\n"));
 2511 michael@paquier.xyz       362                 :              1 :     printf(_("      --min-mxid-age=MXID_AGE     minimum multixact ID age of tables to vacuum\n"));
                                363                 :              1 :     printf(_("      --min-xid-age=XID_AGE       minimum transaction ID age of tables to vacuum\n"));
  273 nathan@postgresql.or      364                 :              1 :     printf(_("      --missing-stats-only        only analyze relations with missing statistics\n"));
 2003 michael@paquier.xyz       365                 :              1 :     printf(_("      --no-index-cleanup          don't remove index entries that point to dead tuples\n"));
 1016                           366                 :              1 :     printf(_("      --no-process-main           skip the main relation\n"));
 1771                           367                 :              1 :     printf(_("      --no-process-toast          skip the TOAST table associated with the table to vacuum\n"));
 2003                           368                 :              1 :     printf(_("      --no-truncate               don't truncate empty pages at the end of the table\n"));
  813 dgustafsson@postgres      369                 :              1 :     printf(_("  -n, --schema=SCHEMA             vacuum tables in the specified schema(s) only\n"));
                                370                 :              1 :     printf(_("  -N, --exclude-schema=SCHEMA     do not vacuum tables in the specified schema(s)\n"));
 1666 akapila@postgresql.o      371                 :              1 :     printf(_("  -P, --parallel=PARALLEL_WORKERS use this many background workers for vacuum, if available\n"));
 8217 peter_e@gmx.net           372                 :              1 :     printf(_("  -q, --quiet                     don't write any messages\n"));
 2534 michael@paquier.xyz       373                 :              1 :     printf(_("      --skip-locked               skip relations that cannot be immediately locked\n"));
 4716 magnus@hagander.net       374                 :              1 :     printf(_("  -t, --table='TABLE[(COLUMNS)]'  vacuum specific table(s) only\n"));
 8217 peter_e@gmx.net           375                 :              1 :     printf(_("  -v, --verbose                   write a lot of output\n"));
 4929                           376                 :              1 :     printf(_("  -V, --version                   output version information, then exit\n"));
 5772 bruce@momjian.us          377                 :              1 :     printf(_("  -z, --analyze                   update optimizer statistics\n"));
 3744 peter_e@gmx.net           378                 :              1 :     printf(_("  -Z, --analyze-only              only update optimizer statistics; no vacuum\n"));
 4264                           379                 :              1 :     printf(_("      --analyze-in-stages         only update optimizer statistics, in multiple\n"
                                380                 :                :              "                                  stages for faster results; no vacuum\n"));
 4929                           381                 :              1 :     printf(_("  -?, --help                      show this help, then exit\n"));
 8217                           382                 :              1 :     printf(_("\nConnection options:\n"));
                                383                 :              1 :     printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
                                384                 :              1 :     printf(_("  -p, --port=PORT           database server port\n"));
                                385                 :              1 :     printf(_("  -U, --username=USERNAME   user name to connect as\n"));
 6137                           386                 :              1 :     printf(_("  -w, --no-password         never prompt for password\n"));
 6580 tgl@sss.pgh.pa.us         387                 :              1 :     printf(_("  -W, --password            force password prompt\n"));
 5124 rhaas@postgresql.org      388                 :              1 :     printf(_("  --maintenance-db=DBNAME   alternate maintenance database\n"));
 8217 peter_e@gmx.net           389                 :              1 :     printf(_("\nRead the description of the SQL command VACUUM for details.\n"));
 2118 peter@eisentraut.org      390                 :              1 :     printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
                                391                 :              1 :     printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
 8217 peter_e@gmx.net           392                 :              1 : }
        

Generated by: LCOV version 2.4-beta