PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <limits.h>
#include "catalog/pg_class_d.h"
#include "common.h"
#include "common/connect.h"
#include "common/logging.h"
#include "fe_utils/cancel.h"
#include "fe_utils/option_utils.h"
#include "fe_utils/parallel_slot.h"
#include "fe_utils/query_utils.h"
#include "fe_utils/simple_list.h"
#include "fe_utils/string_utils.h"
Go to the source code of this file.
Data Structures | |
struct | vacuumingOptions |
Macros | |
#define | ANALYZE_NO_STAGE -1 |
#define | ANALYZE_NUM_STAGES 3 |
Typedefs | |
typedef struct vacuumingOptions | vacuumingOptions |
Enumerations | |
enum | VacObjFilter { OBJFILTER_NONE = 0 , OBJFILTER_ALL_DBS = (1 << 0) , OBJFILTER_DATABASE = (1 << 1) , OBJFILTER_TABLE = (1 << 2) , OBJFILTER_SCHEMA = (1 << 3) , OBJFILTER_SCHEMA_EXCLUDE = (1 << 4) } |
Functions | |
static void | vacuum_one_database (ConnParams *cparams, vacuumingOptions *vacopts, int stage, SimpleStringList *objects, int concurrentCons, const char *progname, bool echo, bool quiet) |
static void | vacuum_all_databases (ConnParams *cparams, vacuumingOptions *vacopts, bool analyze_in_stages, SimpleStringList *objects, int concurrentCons, const char *progname, bool echo, bool quiet) |
static void | prepare_vacuum_command (PQExpBuffer sql, int serverVersion, vacuumingOptions *vacopts, const char *table) |
static void | run_vacuum_command (PGconn *conn, const char *sql, bool echo, const char *table) |
static void | help (const char *progname) |
void | check_objfilter (void) |
static char * | escape_quotes (const char *src) |
int | main (int argc, char *argv[]) |
Variables | |
static VacObjFilter | objfilter = OBJFILTER_NONE |
#define ANALYZE_NO_STAGE -1 |
Definition at line 92 of file vacuumdb.c.
#define ANALYZE_NUM_STAGES 3 |
Definition at line 93 of file vacuumdb.c.
typedef struct vacuumingOptions vacuumingOptions |
enum VacObjFilter |
Enumerator | |
---|---|
OBJFILTER_NONE | |
OBJFILTER_ALL_DBS | |
OBJFILTER_DATABASE | |
OBJFILTER_TABLE | |
OBJFILTER_SCHEMA | |
OBJFILTER_SCHEMA_EXCLUDE |
Definition at line 53 of file vacuumdb.c.
void check_objfilter | ( | void | ) |
Definition at line 428 of file vacuumdb.c.
References objfilter, OBJFILTER_ALL_DBS, OBJFILTER_DATABASE, OBJFILTER_SCHEMA, OBJFILTER_SCHEMA_EXCLUDE, OBJFILTER_TABLE, and pg_fatal.
Referenced by main().
|
static |
Definition at line 452 of file vacuumdb.c.
References escape_single_quotes_ascii(), and pg_fatal.
Referenced by main().
|
static |
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 97 of file vacuumdb.c.
References ANALYZE_NO_STAGE, ANALYZE_NUM_STAGES, vacuumingOptions::analyze_only, vacuumingOptions::and_analyze, vacuumingOptions::buffer_usage_limit, check_objfilter(), dbname, _connParams::dbname, vacuumingOptions::disable_page_skipping, vacuumingOptions::do_truncate, escape_quotes(), exit(), vacuumingOptions::force_index_cleanup, vacuumingOptions::freeze, vacuumingOptions::full, get_progname(), get_user_name_or_exit(), getopt_long(), handle_help_version_opts(), help(), vacuumingOptions::min_mxid_age, vacuumingOptions::min_xid_age, no_argument, vacuumingOptions::no_index_cleanup, objfilter, OBJFILTER_ALL_DBS, OBJFILTER_DATABASE, OBJFILTER_SCHEMA, OBJFILTER_SCHEMA_EXCLUDE, OBJFILTER_TABLE, optarg, optind, option_parse_int(), _connParams::override_dbname, vacuumingOptions::parallel_workers, pg_fatal, pg_log_error, pg_log_error_hint, pg_logging_init(), pg_strdup(), PG_TEXTDOMAIN, _connParams::pghost, _connParams::pgport, _connParams::pguser, port, vacuumingOptions::process_main, vacuumingOptions::process_toast, progname, _connParams::prompt_password, required_argument, set_pglocale_pgservice(), setup_cancel_handler(), simple_string_list_append(), vacuumingOptions::skip_locked, TRI_DEFAULT, TRI_NO, TRI_YES, username, vacuum_all_databases(), vacuum_one_database(), and vacuumingOptions::verbose.
|
static |
Definition at line 963 of file vacuumdb.c.
References vacuumingOptions::analyze_only, vacuumingOptions::and_analyze, appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), Assert, vacuumingOptions::buffer_usage_limit, comma, vacuumingOptions::disable_page_skipping, vacuumingOptions::do_truncate, vacuumingOptions::force_index_cleanup, vacuumingOptions::freeze, vacuumingOptions::full, vacuumingOptions::no_index_cleanup, vacuumingOptions::parallel_workers, vacuumingOptions::process_main, vacuumingOptions::process_toast, resetPQExpBuffer(), vacuumingOptions::skip_database_stats, vacuumingOptions::skip_locked, and vacuumingOptions::verbose.
Referenced by vacuum_one_database().
|
static |
Definition at line 1133 of file vacuumdb.c.
References conn, pg_log_error, PQdb(), PQerrorMessage(), PQsendQuery(), and printf.
Referenced by vacuum_one_database().
|
static |
Definition at line 896 of file vacuumdb.c.
References ANALYZE_NO_STAGE, ANALYZE_NUM_STAGES, conn, connectMaintenanceDatabase(), executeQuery(), i, _connParams::override_dbname, PQclear(), PQfinish(), PQgetvalue(), PQntuples(), progname, and vacuum_one_database().
Referenced by main().
|
static |
Definition at line 475 of file vacuumdb.c.
References _, ALWAYS_SECURE_SEARCH_PATH_SQL, ANALYZE_NO_STAGE, ANALYZE_NUM_STAGES, appendPQExpBuffer(), appendPQExpBufferStr(), appendStringLiteralConn(), Assert, buf, vacuumingOptions::buffer_usage_limit, CancelRequested, conn, connectDatabase(), ParallelSlot::connection, CppAsString2, PQExpBufferData::data, vacuumingOptions::disable_page_skipping, vacuumingOptions::do_truncate, executeCommand(), executeQuery(), exit(), fflush(), fmtQualifiedId(), vacuumingOptions::force_index_cleanup, gettext_noop, SimpleStringList::head, i, initPQExpBuffer(), vacuumingOptions::min_mxid_age, vacuumingOptions::min_xid_age, SimpleStringListCell::next, vacuumingOptions::no_index_cleanup, objfilter, OBJFILTER_SCHEMA, OBJFILTER_SCHEMA_EXCLUDE, OBJFILTER_TABLE, vacuumingOptions::parallel_workers, ParallelSlotsAdoptConn(), ParallelSlotSetHandler(), ParallelSlotsGetIdle(), ParallelSlotsSetup(), ParallelSlotsTerminate(), ParallelSlotsWaitCompletion(), pg_fatal, pg_free(), PQclear(), PQclientEncoding(), PQdb(), PQfinish(), PQgetisnull(), PQgetvalue(), PQntuples(), PQserverVersion(), prepare_vacuum_command(), printf, vacuumingOptions::process_main, vacuumingOptions::process_toast, progname, res, resetPQExpBuffer(), run_vacuum_command(), simple_string_list_append(), vacuumingOptions::skip_database_stats, vacuumingOptions::skip_locked, splitTableColumnsSpec(), generate_unaccent_rules::stdout, TableCommandResultHandler(), termPQExpBuffer(), and SimpleStringListCell::val.
Referenced by main(), and vacuum_all_databases().
|
static |
Definition at line 63 of file vacuumdb.c.
Referenced by check_objfilter(), main(), and vacuum_one_database().