mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Added VERBOSE option to vacuum command.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.13 1997/01/10 09:57:16 vadim Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.14 1997/01/13 03:43:59 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -46,12 +46,7 @@
|
|||||||
#endif /* NEED_RUSAGE */
|
#endif /* NEED_RUSAGE */
|
||||||
|
|
||||||
bool VacuumRunning = false;
|
bool VacuumRunning = false;
|
||||||
|
static int MESSLEV; /* message level */
|
||||||
#ifdef VACUUM_QUIET
|
|
||||||
static int MESSLEV = DEBUG;
|
|
||||||
#else
|
|
||||||
static int MESSLEV = NOTICE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FuncIndexInfo finfo;
|
FuncIndexInfo finfo;
|
||||||
@ -90,10 +85,15 @@ static bool _vc_enough_space (VPageDescr vpd, Size len);
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
vacuum(char *vacrel)
|
vacuum(char *vacrel, bool verbose)
|
||||||
{
|
{
|
||||||
NameData VacRel;
|
NameData VacRel;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
MESSLEV = NOTICE;
|
||||||
|
else
|
||||||
|
MESSLEV = DEBUG;
|
||||||
|
|
||||||
/* vacrel gets de-allocated on transaction commit */
|
/* vacrel gets de-allocated on transaction commit */
|
||||||
|
|
||||||
/* initialize vacuum cleaner */
|
/* initialize vacuum cleaner */
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.23 1996/12/20 20:33:12 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.24 1997/01/13 03:44:18 momjian Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -133,7 +133,8 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
|
|||||||
expr_list, attrs, res_target_list, res_target_list2,
|
expr_list, attrs, res_target_list, res_target_list2,
|
||||||
def_list, opt_indirection, group_clause, groupby_list, explain_options
|
def_list, opt_indirection, group_clause, groupby_list, explain_options
|
||||||
|
|
||||||
%type <boolean> opt_inh_star, opt_binary, opt_instead, opt_with_copy, index_opt_unique
|
%type <boolean> opt_inh_star, opt_binary, opt_instead, opt_with_copy,
|
||||||
|
index_opt_unique, opt_verbose
|
||||||
|
|
||||||
%type <ival> copy_dirn, archive_type, OptArchiveType, OptArchiveLocation,
|
%type <ival> copy_dirn, archive_type, OptArchiveType, OptArchiveLocation,
|
||||||
def_type, opt_direction, remove_type, opt_column, event
|
def_type, opt_direction, remove_type, opt_column, event
|
||||||
@ -187,7 +188,7 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
|
|||||||
RENAME, REPLACE, RETRIEVE, RETURNS, REVOKE, ROLLBACK, RULE,
|
RENAME, REPLACE, RETRIEVE, RETURNS, REVOKE, ROLLBACK, RULE,
|
||||||
SELECT, SET, SETOF, STDIN, STDOUT, STORE,
|
SELECT, SET, SETOF, STDIN, STDOUT, STORE,
|
||||||
TABLE, TO, TRANSACTION, UNIQUE, UPDATE, USING, VACUUM, VALUES
|
TABLE, TO, TRANSACTION, UNIQUE, UPDATE, USING, VACUUM, VALUES
|
||||||
VERSION, VIEW, WHERE, WITH, WORK
|
VERBOSE, VERSION, VIEW, WHERE, WITH, WORK
|
||||||
%token EXECUTE, RECIPE, EXPLAIN, LIKE
|
%token EXECUTE, RECIPE, EXPLAIN, LIKE
|
||||||
|
|
||||||
/* Special keywords, not in the query language - see the "lex" file */
|
/* Special keywords, not in the query language - see the "lex" file */
|
||||||
@ -1200,16 +1201,23 @@ ClusterStmt: CLUSTER index_name ON relation_name
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
VacuumStmt: VACUUM
|
VacuumStmt: VACUUM opt_verbose
|
||||||
{
|
|
||||||
$$ = (Node *)makeNode(VacuumStmt);
|
|
||||||
}
|
|
||||||
| VACUUM relation_name
|
|
||||||
{
|
{
|
||||||
VacuumStmt *n = makeNode(VacuumStmt);
|
VacuumStmt *n = makeNode(VacuumStmt);
|
||||||
n->vacrel = $2;
|
n->verbose = $2;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
|
| VACUUM opt_verbose relation_name
|
||||||
|
{
|
||||||
|
VacuumStmt *n = makeNode(VacuumStmt);
|
||||||
|
n->verbose = $2;
|
||||||
|
n->vacrel = $3;
|
||||||
|
$$ = (Node *)n;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
opt_verbose: VERBOSE { $$ = TRUE; }
|
||||||
|
| /* EMPTY */ { $$ = FALSE; }
|
||||||
;
|
;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.5 1996/11/30 03:38:07 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.6 1997/01/13 03:44:25 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -136,6 +136,7 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
{ "using", USING },
|
{ "using", USING },
|
||||||
{ "vacuum", VACUUM },
|
{ "vacuum", VACUUM },
|
||||||
{ "values", VALUES },
|
{ "values", VALUES },
|
||||||
|
{ "verbose", VERBOSE },
|
||||||
{ "version", VERSION },
|
{ "version", VERSION },
|
||||||
{ "view", VIEW },
|
{ "view", VIEW },
|
||||||
{ "where", WHERE },
|
{ "where", WHERE },
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.9 1996/11/13 20:49:50 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.10 1997/01/13 03:44:38 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -580,7 +580,8 @@ ProcessUtility(Node *parsetree,
|
|||||||
case T_VacuumStmt:
|
case T_VacuumStmt:
|
||||||
commandTag = "VACUUM";
|
commandTag = "VACUUM";
|
||||||
CHECK_IF_ABORTED();
|
CHECK_IF_ABORTED();
|
||||||
vacuum(((VacuumStmt *) parsetree)->vacrel);
|
vacuum( ((VacuumStmt *) parsetree)->vacrel,
|
||||||
|
((VacuumStmt *) parsetree)->verbose);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_ExplainStmt:
|
case T_ExplainStmt:
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: vacuum.h,v 1.4 1996/11/29 10:29:45 vadim Exp $
|
* $Id: vacuum.h,v 1.5 1997/01/13 03:44:54 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -54,7 +54,7 @@ typedef VRelListData *VRelList;
|
|||||||
extern bool VacuumRunning;
|
extern bool VacuumRunning;
|
||||||
|
|
||||||
extern void vc_abort(void);
|
extern void vc_abort(void);
|
||||||
extern void vacuum(char *vacrel);
|
extern void vacuum(char *vacrel, bool verbose);
|
||||||
|
|
||||||
|
|
||||||
#endif /* VACUUM_H */
|
#endif /* VACUUM_H */
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: parsenodes.h,v 1.8 1996/12/17 01:53:43 momjian Exp $
|
* $Id: parsenodes.h,v 1.9 1997/01/13 03:45:02 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -397,6 +397,7 @@ typedef struct ClusterStmt {
|
|||||||
*/
|
*/
|
||||||
typedef struct VacuumStmt {
|
typedef struct VacuumStmt {
|
||||||
NodeTag type;
|
NodeTag type;
|
||||||
|
bool verbose; /* print status info */
|
||||||
char *vacrel; /* table to vacuum */
|
char *vacrel; /* table to vacuum */
|
||||||
} VacuumStmt;
|
} VacuumStmt;
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" XXX standard disclaimer belongs here....
|
||||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/vacuum.l,v 1.2 1996/12/11 00:28:15 momjian Exp $
|
.\" $Header: /cvsroot/pgsql/src/man/Attic/vacuum.l,v 1.3 1997/01/13 03:45:33 momjian Exp $
|
||||||
.TH VACUUM SQL 11/05/95 PostgreSQL PostgreSQL
|
.TH VACUUM SQL 11/05/95 PostgreSQL PostgreSQL
|
||||||
.SH NAME
|
.SH NAME
|
||||||
vacuum \(em vacuum a database
|
vacuum \(em vacuum a database
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
\fBvacuum [table]\fP
|
\fBvacuum [verbose] [\fPtable\fB]\fP
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR Vacuum
|
.BR Vacuum
|
||||||
@ -18,6 +18,8 @@ tuples and number of pages stored in all classes. Running
|
|||||||
.BR vacuum
|
.BR vacuum
|
||||||
periodically will increase Postgres's speed in processing user queries.
|
periodically will increase Postgres's speed in processing user queries.
|
||||||
.PP
|
.PP
|
||||||
|
\fBverbose\fP prints a detailed vacuum activity report for each table.
|
||||||
|
.PP
|
||||||
The open database is the one that is vacuumed.
|
The open database is the one that is vacuumed.
|
||||||
.PP
|
.PP
|
||||||
We recommend that production databases be vacuumed nightly, in order
|
We recommend that production databases be vacuumed nightly, in order
|
||||||
|
Reference in New Issue
Block a user