LCOV - differential code coverage report
Current view: top level - src/bin/scripts - vacuumdb.c (source / functions) Coverage Total Hit UNC UBC GNC CBC DUB DCB
Current: a2387c32f2f8a1643c7d71b951587e6bcb2d4744 vs 371a302eecdc82274b0ae2967d18fd726a0aa6a1 Lines: 86.0 % 235 202 2 31 28 174 74 273
Current Date: 2025-10-26 12:31:50 -0700 Functions: 100.0 % 3 3 2 1 1 6
Baseline: lcov-20251027-010456-baseline Branches: 78.4 % 111 87 4 20 14 73
Baseline Date: 2025-10-26 11:01:32 +1300 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(30,360] days: 91.4 % 35 32 2 1 28 4
(360..) days: 85.0 % 200 170 30 170
Function coverage date bins:
(30,360] days: 100.0 % 1 1 1
(360..) days: 100.0 % 2 2 1 1
Branch coverage date bins:
(30,360] days: 77.8 % 18 14 4 14
(360..) days: 78.5 % 93 73 20 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
 8167 peter_e@gmx.net            27                 :CBC          98 : 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                 :                :         {NULL, 0, NULL, 0}
                                 63                 :                :     };
                                 64                 :                : 
                                 65                 :                :     const char *progname;
                                 66                 :                :     int         optindex;
                                 67                 :                :     int         c;
                                 68                 :             98 :     const char *dbname = NULL;
 5074 rhaas@postgresql.org       69                 :             98 :     const char *maintenance_db = NULL;
                                 70                 :                :     ConnParams  cparams;
 8167 peter_e@gmx.net            71                 :             98 :     bool        echo = false;
                                 72                 :             98 :     bool        quiet = false;
                                 73                 :                :     vacuumingOptions vacopts;
 1184 andrew@dunslane.net        74                 :             98 :     SimpleStringList objects = {NULL, NULL};
 3930 alvherre@alvh.no-ip.       75                 :             98 :     int         concurrentCons = 1;
   31 alvherre@kurilemu.de       76                 :GNC          98 :     unsigned int tbl_count = 0;
                                 77                 :                :     int         ret;
                                 78                 :                : 
                                 79                 :                :     /* initialize options */
 3930 alvherre@alvh.no-ip.       80                 :CBC          98 :     memset(&vacopts, 0, sizeof(vacopts));
   31 alvherre@kurilemu.de       81                 :GNC          98 :     vacopts.objfilter = 0;      /* no filter */
 2098 akapila@postgresql.o       82                 :CBC          98 :     vacopts.parallel_workers = -1;
  934 drowley@postgresql.o       83                 :             98 :     vacopts.buffer_usage_limit = NULL;
 1592 pg@bowt.ie                 84                 :             98 :     vacopts.no_index_cleanup = false;
                                 85                 :             98 :     vacopts.force_index_cleanup = false;
 1953 michael@paquier.xyz        86                 :             98 :     vacopts.do_truncate = true;
  966                            87                 :             98 :     vacopts.process_main = true;
 1721                            88                 :             98 :     vacopts.process_toast = true;
                                 89                 :                : 
                                 90                 :                :     /* the same for connection parameters */
   31 alvherre@kurilemu.de       91                 :GNC          98 :     memset(&cparams, 0, sizeof(cparams));
                                 92                 :             98 :     cparams.prompt_password = TRI_DEFAULT;
                                 93                 :                : 
 2401 peter@eisentraut.org       94                 :CBC          98 :     pg_logging_init(argv[0]);
 8167 peter_e@gmx.net            95                 :             98 :     progname = get_progname(argv[0]);
 6164                            96                 :             98 :     set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
                                 97                 :                : 
 8167                            98                 :             98 :     handle_help_version_opts(argc, argv, "vacuumdb", help);
                                 99                 :                : 
   31 alvherre@kurilemu.de      100                 :GNC         267 :     while ((c = getopt_long(argc, argv, "ad:efFh:j:n:N:p:P:qt:U:vwWzZ",
                                101         [ +  + ]:            267 :                             long_options, &optindex)) != -1)
                                102                 :                :     {
 8167 peter_e@gmx.net           103   [ +  +  +  +  :CBC         192 :         switch (c)
                                     +  +  +  +  +  
                                     +  +  -  +  +  
                                     -  -  -  +  +  
                                     -  +  +  +  +  
                                     +  +  -  +  +  
                                        +  -  +  + ]
                                104                 :                :         {
 1050 peter@eisentraut.org      105                 :             25 :             case 'a':
   31 alvherre@kurilemu.de      106                 :GNC          25 :                 vacopts.objfilter |= OBJFILTER_ALL_DBS;
 8167 peter_e@gmx.net           107                 :CBC          25 :                 break;
                                108                 :              2 :             case 'd':
   31 alvherre@kurilemu.de      109                 :GNC           2 :                 vacopts.objfilter |= OBJFILTER_DATABASE;
 4763 bruce@momjian.us          110                 :CBC           2 :                 dbname = pg_strdup(optarg);
 8167 peter_e@gmx.net           111                 :              2 :                 break;
 1050 peter@eisentraut.org      112                 :              1 :             case 'e':
                                113                 :              1 :                 echo = true;
 5773 bruce@momjian.us          114                 :              1 :                 break;
 1050 peter@eisentraut.org      115                 :              1 :             case 'f':
                                116                 :              1 :                 vacopts.full = true;
 8167 peter_e@gmx.net           117                 :              1 :                 break;
 6095 bruce@momjian.us          118                 :              9 :             case 'F':
 3930 alvherre@alvh.no-ip.      119                 :              9 :                 vacopts.freeze = true;
 6095 bruce@momjian.us          120                 :              9 :                 break;
 1050 peter@eisentraut.org      121                 :             16 :             case 'h':
   31 alvherre@kurilemu.de      122                 :GNC          16 :                 cparams.pghost = pg_strdup(optarg);
 3930 alvherre@alvh.no-ip.      123                 :CBC          16 :                 break;
                                124                 :              1 :             case 'j':
 1556 michael@paquier.xyz       125         [ -  + ]:              1 :                 if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
                                126                 :                :                                       &concurrentCons))
 3930 alvherre@alvh.no-ip.      127                 :UBC           0 :                     exit(1);
 8167 peter_e@gmx.net           128                 :CBC           1 :                 break;
 1050 peter@eisentraut.org      129                 :              6 :             case 'n':
   31 alvherre@kurilemu.de      130                 :GNC           6 :                 vacopts.objfilter |= OBJFILTER_SCHEMA;
 1050 peter@eisentraut.org      131                 :CBC           6 :                 simple_string_list_append(&objects, optarg);
                                132                 :              6 :                 break;
                                133                 :              6 :             case 'N':
   31 alvherre@kurilemu.de      134                 :GNC           6 :                 vacopts.objfilter |= OBJFILTER_SCHEMA_EXCLUDE;
 1050 peter@eisentraut.org      135                 :CBC           6 :                 simple_string_list_append(&objects, optarg);
                                136                 :              6 :                 break;
                                137                 :             16 :             case 'p':
   31 alvherre@kurilemu.de      138                 :GNC          16 :                 cparams.pgport = pg_strdup(optarg);
 1050 peter@eisentraut.org      139                 :CBC          16 :                 break;
 2098 akapila@postgresql.o      140                 :              3 :             case 'P':
 1556 michael@paquier.xyz       141         [ +  + ]:              3 :                 if (!option_parse_int(optarg, "-P/--parallel", 0, INT_MAX,
                                142                 :                :                                       &vacopts.parallel_workers))
 2098 akapila@postgresql.o      143                 :              1 :                     exit(1);
                                144                 :              2 :                 break;
 1050 peter@eisentraut.org      145                 :UBC           0 :             case 'q':
                                146                 :              0 :                 quiet = true;
                                147                 :              0 :                 break;
 1050 peter@eisentraut.org      148                 :CBC          24 :             case 't':
   31 alvherre@kurilemu.de      149                 :GNC          24 :                 vacopts.objfilter |= OBJFILTER_TABLE;
 1050 peter@eisentraut.org      150                 :CBC          24 :                 simple_string_list_append(&objects, optarg);
                                151                 :             24 :                 tbl_count++;
                                152                 :             24 :                 break;
                                153                 :             16 :             case 'U':
   31 alvherre@kurilemu.de      154                 :GNC          16 :                 cparams.pguser = pg_strdup(optarg);
 1050 peter@eisentraut.org      155                 :CBC          16 :                 break;
 1050 peter@eisentraut.org      156                 :UBC           0 :             case 'v':
                                157                 :              0 :                 vacopts.verbose = true;
                                158                 :              0 :                 break;
                                159                 :              0 :             case 'w':
   31 alvherre@kurilemu.de      160                 :UNC           0 :                 cparams.prompt_password = TRI_NO;
 1050 peter@eisentraut.org      161                 :UBC           0 :                 break;
                                162                 :              0 :             case 'W':
   31 alvherre@kurilemu.de      163                 :UNC           0 :                 cparams.prompt_password = TRI_YES;
 1050 peter@eisentraut.org      164                 :UBC           0 :                 break;
 1050 peter@eisentraut.org      165                 :CBC          12 :             case 'z':
                                166                 :             12 :                 vacopts.and_analyze = true;
                                167                 :             12 :                 break;
                                168                 :             21 :             case 'Z':
                                169                 :                :                 /* if analyze-in-stages is given, don't override it */
   31 alvherre@kurilemu.de      170         [ +  - ]:GNC          21 :                 if (vacopts.mode != MODE_ANALYZE_IN_STAGES)
                                171                 :             21 :                     vacopts.mode = MODE_ANALYZE;
 1050 peter@eisentraut.org      172                 :CBC          21 :                 break;
 5074 rhaas@postgresql.org      173                 :UBC           0 :             case 2:
 4763 bruce@momjian.us          174                 :              0 :                 maintenance_db = pg_strdup(optarg);
 5074 rhaas@postgresql.org      175                 :              0 :                 break;
 4214 peter_e@gmx.net           176                 :CBC           6 :             case 3:
   31 alvherre@kurilemu.de      177                 :GNC           6 :                 vacopts.mode = MODE_ANALYZE_IN_STAGES;
 4214 peter_e@gmx.net           178                 :CBC           6 :                 break;
 2484 michael@paquier.xyz       179                 :              2 :             case 4:
                                180                 :              2 :                 vacopts.disable_page_skipping = true;
                                181                 :              2 :                 break;
                                182                 :              2 :             case 5:
                                183                 :              2 :                 vacopts.skip_locked = true;
                                184                 :              2 :                 break;
 2461                           185                 :              2 :             case 6:
 1556                           186         [ +  + ]:              2 :                 if (!option_parse_int(optarg, "--min-xid-age", 1, INT_MAX,
                                187                 :                :                                       &vacopts.min_xid_age))
 2461                           188                 :              1 :                     exit(1);
                                189                 :              1 :                 break;
                                190                 :              2 :             case 7:
 1556                           191         [ +  + ]:              2 :                 if (!option_parse_int(optarg, "--min-mxid-age", 1, INT_MAX,
                                192                 :                :                                       &vacopts.min_mxid_age))
 2461                           193                 :              1 :                     exit(1);
                                194                 :              1 :                 break;
 1953                           195                 :              2 :             case 8:
 1592 pg@bowt.ie                196                 :              2 :                 vacopts.no_index_cleanup = true;
 1953 michael@paquier.xyz       197                 :              2 :                 break;
 1953 michael@paquier.xyz       198                 :UBC           0 :             case 9:
 1592 pg@bowt.ie                199                 :              0 :                 vacopts.force_index_cleanup = true;
 1953 michael@paquier.xyz       200                 :              0 :                 break;
 1721 michael@paquier.xyz       201                 :CBC           2 :             case 10:
 1592 pg@bowt.ie                202                 :              2 :                 vacopts.do_truncate = false;
                                203                 :              2 :                 break;
                                204                 :              2 :             case 11:
 1721 michael@paquier.xyz       205                 :              2 :                 vacopts.process_toast = false;
                                206                 :              2 :                 break;
  966                           207                 :              2 :             case 12:
                                208                 :              2 :                 vacopts.process_main = false;
                                209                 :              2 :                 break;
  934 drowley@postgresql.o      210                 :UBC           0 :             case 13:
  767                           211                 :              0 :                 vacopts.buffer_usage_limit = escape_quotes(optarg);
  934                           212                 :              0 :                 break;
  223 nathan@postgresql.or      213                 :CBC          10 :             case 14:
                                214                 :             10 :                 vacopts.missing_stats_only = true;
                                215                 :             10 :                 break;
 8167 peter_e@gmx.net           216                 :              1 :             default:
                                217                 :                :                 /* getopt_long already emitted a complaint */
 1298 tgl@sss.pgh.pa.us         218                 :              1 :                 pg_log_error_hint("Try \"%s --help\" for more information.", progname);
 8167 peter_e@gmx.net           219                 :              1 :                 exit(1);
                                220                 :                :         }
                                221                 :                :     }
                                222                 :                : 
                                223                 :                :     /*
                                224                 :                :      * Non-option argument specifies database name as long as it wasn't
                                225                 :                :      * already specified with -d / --dbname
                                226                 :                :      */
 4941 andrew@dunslane.net       227   [ +  +  +  - ]:             75 :     if (optind < argc && dbname == NULL)
                                228                 :                :     {
   31 alvherre@kurilemu.de      229                 :GNC          50 :         vacopts.objfilter |= OBJFILTER_DATABASE;
 4941 andrew@dunslane.net       230                 :CBC          50 :         dbname = argv[optind];
                                231                 :             50 :         optind++;
                                232                 :                :     }
                                233                 :                : 
                                234         [ -  + ]:             75 :     if (optind < argc)
                                235                 :                :     {
 2401 peter@eisentraut.org      236                 :UBC           0 :         pg_log_error("too many command-line arguments (first is \"%s\")",
                                237                 :                :                      argv[optind]);
 1298 tgl@sss.pgh.pa.us         238                 :              0 :         pg_log_error_hint("Try \"%s --help\" for more information.", progname);
 4941 andrew@dunslane.net       239                 :              0 :         exit(1);
                                240                 :                :     }
                                241                 :                : 
                                242                 :                :     /*
                                243                 :                :      * Validate the combination of filters specified in the command-line
                                244                 :                :      * options.
                                245                 :                :      */
   31 alvherre@kurilemu.de      246                 :GNC          75 :     check_objfilter(vacopts.objfilter);
                                247                 :                : 
                                248         [ +  + ]:             70 :     if (vacopts.mode == MODE_ANALYZE ||
                                249         [ +  + ]:             49 :         vacopts.mode == MODE_ANALYZE_IN_STAGES)
                                250                 :                :     {
 3930 alvherre@alvh.no-ip.      251         [ -  + ]:CBC          27 :         if (vacopts.full)
 1298 tgl@sss.pgh.pa.us         252                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                253                 :                :                      "full");
 3930 alvherre@alvh.no-ip.      254         [ -  + ]:CBC          27 :         if (vacopts.freeze)
 1298 tgl@sss.pgh.pa.us         255                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                256                 :                :                      "freeze");
 2484 michael@paquier.xyz       257         [ +  + ]:CBC          27 :         if (vacopts.disable_page_skipping)
 1298 tgl@sss.pgh.pa.us         258                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                259                 :                :                      "disable-page-skipping");
 1592 pg@bowt.ie                260         [ +  + ]:             26 :         if (vacopts.no_index_cleanup)
 1298 tgl@sss.pgh.pa.us         261                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                262                 :                :                      "no-index-cleanup");
 1592 pg@bowt.ie                263         [ -  + ]:             25 :         if (vacopts.force_index_cleanup)
 1298 tgl@sss.pgh.pa.us         264                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                265                 :                :                      "force-index-cleanup");
 1953 michael@paquier.xyz       266         [ +  + ]:CBC          25 :         if (!vacopts.do_truncate)
 1298 tgl@sss.pgh.pa.us         267                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                268                 :                :                      "no-truncate");
  966 michael@paquier.xyz       269         [ +  + ]:             24 :         if (!vacopts.process_main)
                                270                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                271                 :                :                      "no-process-main");
 1721                           272         [ +  + ]:             23 :         if (!vacopts.process_toast)
 1298 tgl@sss.pgh.pa.us         273                 :              1 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                274                 :                :                      "no-process-toast");
                                275                 :                :         /* allow 'and_analyze' with 'analyze_only' */
                                276                 :                :     }
                                277                 :                : 
                                278                 :                :     /* Prohibit full and analyze_only options with parallel option */
 2098 akapila@postgresql.o      279         [ +  + ]:             65 :     if (vacopts.parallel_workers >= 0)
                                280                 :                :     {
   31 alvherre@kurilemu.de      281         [ +  - ]:GNC           2 :         if (vacopts.mode == MODE_ANALYZE ||
                                282         [ -  + ]:              2 :             vacopts.mode == MODE_ANALYZE_IN_STAGES)
 1298 tgl@sss.pgh.pa.us         283                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing only analyze",
                                284                 :                :                      "parallel");
 2098 akapila@postgresql.o      285         [ -  + ]:CBC           2 :         if (vacopts.full)
 1298 tgl@sss.pgh.pa.us         286                 :UBC           0 :             pg_fatal("cannot use the \"%s\" option when performing full vacuum",
                                287                 :                :                      "parallel");
                                288                 :                :     }
                                289                 :                : 
                                290                 :                :     /* Prohibit --no-index-cleanup and --force-index-cleanup together */
 1592 pg@bowt.ie                291   [ +  +  -  + ]:CBC          65 :     if (vacopts.no_index_cleanup && vacopts.force_index_cleanup)
 1298 tgl@sss.pgh.pa.us         292                 :UBC           0 :         pg_fatal("cannot use the \"%s\" option with the \"%s\" option",
                                293                 :                :                  "no-index-cleanup", "force-index-cleanup");
                                294                 :                : 
                                295                 :                :     /*
                                296                 :                :      * buffer-usage-limit is not allowed with VACUUM FULL unless ANALYZE is
                                297                 :                :      * included too.
                                298                 :                :      */
  934 drowley@postgresql.o      299   [ -  +  -  -  :CBC          65 :     if (vacopts.buffer_usage_limit && vacopts.full && !vacopts.and_analyze)
                                              -  - ]
  934 drowley@postgresql.o      300                 :UBC           0 :         pg_fatal("cannot use the \"%s\" option with the \"%s\" option",
                                301                 :                :                  "buffer-usage-limit", "full");
                                302                 :                : 
                                303                 :                :     /*
                                304                 :                :      * Prohibit --missing-stats-only without --analyze-only or
                                305                 :                :      * --analyze-in-stages.
                                306                 :                :      */
   31 alvherre@kurilemu.de      307   [ +  +  +  + ]:GNC          65 :     if (vacopts.missing_stats_only && (vacopts.mode != MODE_ANALYZE &&
                                308         [ -  + ]:              4 :                                        vacopts.mode != MODE_ANALYZE_IN_STAGES))
  223 nathan@postgresql.or      309                 :UBC           0 :         pg_fatal("cannot use the \"%s\" option without \"%s\" or \"%s\"",
                                310                 :                :                  "missing-stats-only", "analyze-only", "analyze-in-stages");
                                311                 :                : 
   31 alvherre@kurilemu.de      312                 :GNC          65 :     ret = vacuuming_main(&cparams, dbname, maintenance_db, &vacopts,
                                313                 :                :                          &objects, tbl_count,
                                314                 :                :                          concurrentCons,
                                315                 :                :                          progname, echo, quiet);
                                316                 :             63 :     exit(ret);
                                317                 :                : }
                                318                 :                : 
                                319                 :                : /*
                                320                 :                :  * Verify that the filters used at command line are compatible.
                                321                 :                :  */
                                322                 :                : void
                                323                 :             75 : check_objfilter(bits32 objfilter)
                                324                 :                : {
 1184 andrew@dunslane.net       325         [ +  + ]:CBC          75 :     if ((objfilter & OBJFILTER_ALL_DBS) &&
                                326         [ +  + ]:             25 :         (objfilter & OBJFILTER_DATABASE))
                                327                 :              2 :         pg_fatal("cannot vacuum all databases and a specific one at the same time");
                                328                 :                : 
                                329         [ +  + ]:             73 :     if ((objfilter & OBJFILTER_TABLE) &&
                                330         [ +  + ]:             22 :         (objfilter & OBJFILTER_SCHEMA))
                                331                 :              1 :         pg_fatal("cannot vacuum all tables in schema(s) and specific table(s) at the same time");
                                332                 :                : 
                                333         [ +  + ]:             72 :     if ((objfilter & OBJFILTER_TABLE) &&
                                334         [ +  + ]:             21 :         (objfilter & OBJFILTER_SCHEMA_EXCLUDE))
                                335                 :              1 :         pg_fatal("cannot vacuum specific table(s) and exclude schema(s) at the same time");
                                336                 :                : 
                                337         [ +  + ]:             71 :     if ((objfilter & OBJFILTER_SCHEMA) &&
                                338         [ +  + ]:              4 :         (objfilter & OBJFILTER_SCHEMA_EXCLUDE))
                                339                 :              1 :         pg_fatal("cannot vacuum all tables in schema(s) and exclude schema(s) at the same time");
                                340                 :             70 : }
                                341                 :                : 
                                342                 :                : 
                                343                 :                : static void
 8167 peter_e@gmx.net           344                 :              1 : help(const char *progname)
                                345                 :                : {
                                346                 :              1 :     printf(_("%s cleans and analyzes a PostgreSQL database.\n\n"), progname);
                                347                 :              1 :     printf(_("Usage:\n"));
                                348                 :              1 :     printf(_("  %s [OPTION]... [DBNAME]\n"), progname);
                                349                 :              1 :     printf(_("\nOptions:\n"));
                                350                 :              1 :     printf(_("  -a, --all                       vacuum all databases\n"));
  925 drowley@postgresql.o      351                 :              1 :     printf(_("      --buffer-usage-limit=SIZE   size of ring buffer used for vacuum\n"));
 8167 peter_e@gmx.net           352                 :              1 :     printf(_("  -d, --dbname=DBNAME             database to vacuum\n"));
 2484 michael@paquier.xyz       353                 :              1 :     printf(_("      --disable-page-skipping     disable all page-skipping behavior\n"));
 6088 peter_e@gmx.net           354                 :              1 :     printf(_("  -e, --echo                      show the commands being sent to the server\n"));
 8167                           355                 :              1 :     printf(_("  -f, --full                      do full vacuuming\n"));
 6095 bruce@momjian.us          356                 :              1 :     printf(_("  -F, --freeze                    freeze row transaction information\n"));
 1585 peter@eisentraut.org      357                 :              1 :     printf(_("      --force-index-cleanup       always remove index entries that point to dead tuples\n"));
 3694 peter_e@gmx.net           358                 :              1 :     printf(_("  -j, --jobs=NUM                  use this many concurrent connections to vacuum\n"));
 2461 michael@paquier.xyz       359                 :              1 :     printf(_("      --min-mxid-age=MXID_AGE     minimum multixact ID age of tables to vacuum\n"));
                                360                 :              1 :     printf(_("      --min-xid-age=XID_AGE       minimum transaction ID age of tables to vacuum\n"));
  223 nathan@postgresql.or      361                 :              1 :     printf(_("      --missing-stats-only        only analyze relations with missing statistics\n"));
 1953 michael@paquier.xyz       362                 :              1 :     printf(_("      --no-index-cleanup          don't remove index entries that point to dead tuples\n"));
  966                           363                 :              1 :     printf(_("      --no-process-main           skip the main relation\n"));
 1721                           364                 :              1 :     printf(_("      --no-process-toast          skip the TOAST table associated with the table to vacuum\n"));
 1953                           365                 :              1 :     printf(_("      --no-truncate               don't truncate empty pages at the end of the table\n"));
  763 dgustafsson@postgres      366                 :              1 :     printf(_("  -n, --schema=SCHEMA             vacuum tables in the specified schema(s) only\n"));
                                367                 :              1 :     printf(_("  -N, --exclude-schema=SCHEMA     do not vacuum tables in the specified schema(s)\n"));
 1616 akapila@postgresql.o      368                 :              1 :     printf(_("  -P, --parallel=PARALLEL_WORKERS use this many background workers for vacuum, if available\n"));
 8167 peter_e@gmx.net           369                 :              1 :     printf(_("  -q, --quiet                     don't write any messages\n"));
 2484 michael@paquier.xyz       370                 :              1 :     printf(_("      --skip-locked               skip relations that cannot be immediately locked\n"));
 4666 magnus@hagander.net       371                 :              1 :     printf(_("  -t, --table='TABLE[(COLUMNS)]'  vacuum specific table(s) only\n"));
 8167 peter_e@gmx.net           372                 :              1 :     printf(_("  -v, --verbose                   write a lot of output\n"));
 4879                           373                 :              1 :     printf(_("  -V, --version                   output version information, then exit\n"));
 5722 bruce@momjian.us          374                 :              1 :     printf(_("  -z, --analyze                   update optimizer statistics\n"));
 3694 peter_e@gmx.net           375                 :              1 :     printf(_("  -Z, --analyze-only              only update optimizer statistics; no vacuum\n"));
 4214                           376                 :              1 :     printf(_("      --analyze-in-stages         only update optimizer statistics, in multiple\n"
                                377                 :                :              "                                  stages for faster results; no vacuum\n"));
 4879                           378                 :              1 :     printf(_("  -?, --help                      show this help, then exit\n"));
 8167                           379                 :              1 :     printf(_("\nConnection options:\n"));
                                380                 :              1 :     printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
                                381                 :              1 :     printf(_("  -p, --port=PORT           database server port\n"));
                                382                 :              1 :     printf(_("  -U, --username=USERNAME   user name to connect as\n"));
 6087                           383                 :              1 :     printf(_("  -w, --no-password         never prompt for password\n"));
 6530 tgl@sss.pgh.pa.us         384                 :              1 :     printf(_("  -W, --password            force password prompt\n"));
 5074 rhaas@postgresql.org      385                 :              1 :     printf(_("  --maintenance-db=DBNAME   alternate maintenance database\n"));
 8167 peter_e@gmx.net           386                 :              1 :     printf(_("\nRead the description of the SQL command VACUUM for details.\n"));
 2068 peter@eisentraut.org      387                 :              1 :     printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
                                388                 :              1 :     printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
 8167 peter_e@gmx.net           389                 :              1 : }
        

Generated by: LCOV version 2.4-beta