Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d3bf78

Browse files
committed
Added VERBOSE option to vacuum command.
1 parentfebfe44 commit0d3bf78

File tree

7 files changed

+36
-23
lines changed

7 files changed

+36
-23
lines changed

‎src/backend/commands/vacuum.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.13 1997/01/10 09:57:16 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.14 1997/01/13 03:43:59 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,12 +46,7 @@
4646
#endif/* NEED_RUSAGE */
4747

4848
boolVacuumRunning=false;
49-
50-
#ifdefVACUUM_QUIET
51-
staticintMESSLEV=DEBUG;
52-
#else
53-
staticintMESSLEV=NOTICE;
54-
#endif
49+
staticintMESSLEV;/* message level */
5550

5651
typedefstruct {
5752
FuncIndexInfofinfo;
@@ -90,10 +85,15 @@ static bool _vc_enough_space (VPageDescr vpd, Size len);
9085

9186

9287
void
93-
vacuum(char*vacrel)
88+
vacuum(char*vacrel,boolverbose)
9489
{
9590
NameDataVacRel;
9691

92+
if (verbose)
93+
MESSLEV=NOTICE;
94+
else
95+
MESSLEV=DEBUG;
96+
9797
/* vacrel gets de-allocated on transaction commit */
9898

9999
/* initialize vacuum cleaner */

‎src/backend/parser/gram.y

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.23 1996/12/20 20:33:12 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.24 1997/01/13 03:44:18 momjian Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -133,7 +133,8 @@ static Node *makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr);
133133
expr_list, attrs, res_target_list, res_target_list2,
134134
def_list, opt_indirection, group_clause, groupby_list, explain_options
135135

136-
%type <boolean>opt_inh_star, opt_binary, opt_instead, opt_with_copy, index_opt_unique
136+
%type <boolean>opt_inh_star, opt_binary, opt_instead, opt_with_copy,
137+
index_opt_unique, opt_verbose
137138

138139
%type <ival>copy_dirn, archive_type, OptArchiveType, OptArchiveLocation,
139140
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);
187188
RENAME, REPLACE, RETRIEVE, RETURNS, REVOKE, ROLLBACK, RULE,
188189
SELECT, SET, SETOF, STDIN, STDOUT, STORE,
189190
TABLE, TO, TRANSACTION, UNIQUE, UPDATE, USING, VACUUM, VALUES
190-
VERSION, VIEW, WHERE, WITH, WORK
191+
VERBOSE,VERSION, VIEW, WHERE, WITH, WORK
191192
%tokenEXECUTE, RECIPE, EXPLAIN, LIKE
192193

193194
/* Special keywords, not in the query language - see the "lex" file */
@@ -1200,18 +1201,25 @@ ClusterStmt: CLUSTER index_name ON relation_name
12001201
*
12011202
*****************************************************************************/
12021203

1203-
VacuumStmt: VACUUM
1204+
VacuumStmt: VACUUM opt_verbose
12041205
{
1205-
$$ = (Node *)makeNode(VacuumStmt);
1206+
VacuumStmt *n = makeNode(VacuumStmt);
1207+
n->verbose = $2;
1208+
$$ = (Node *)n;
12061209
}
1207-
| VACUUM relation_name
1210+
| VACUUMopt_verboserelation_name
12081211
{
12091212
VacuumStmt *n = makeNode(VacuumStmt);
1210-
n->vacrel = $2;
1213+
n->verbose = $2;
1214+
n->vacrel = $3;
12111215
$$ = (Node *)n;
12121216
}
12131217
;
12141218

1219+
opt_verbose: VERBOSE{ $$ = TRUE; }
1220+
| /* EMPTY */{ $$ = FALSE; }
1221+
;
1222+
12151223
/*****************************************************************************
12161224
*
12171225
*QUERY:

‎src/backend/parser/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.5 1996/11/30 03:38:07 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.6 1997/01/13 03:44:25 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -136,6 +136,7 @@ static ScanKeyword ScanKeywords[] = {
136136
{"using",USING},
137137
{"vacuum",VACUUM},
138138
{"values",VALUES},
139+
{"verbose",VERBOSE},
139140
{"version",VERSION},
140141
{"view",VIEW},
141142
{"where",WHERE},

‎src/backend/tcop/utility.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.9 1996/11/1320:49:50 scrappy Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.10 1997/01/1303:44:38 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -580,7 +580,8 @@ ProcessUtility(Node *parsetree,
580580
caseT_VacuumStmt:
581581
commandTag="VACUUM";
582582
CHECK_IF_ABORTED();
583-
vacuum(((VacuumStmt*)parsetree)->vacrel);
583+
vacuum( ((VacuumStmt*)parsetree)->vacrel,
584+
((VacuumStmt*)parsetree)->verbose);
584585
break;
585586

586587
caseT_ExplainStmt:

‎src/include/commands/vacuum.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: vacuum.h,v 1.4 1996/11/29 10:29:45 vadim Exp $
9+
* $Id: vacuum.h,v 1.5 1997/01/13 03:44:54 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -54,7 +54,7 @@ typedef VRelListData*VRelList;
5454
externboolVacuumRunning;
5555

5656
externvoidvc_abort(void);
57-
externvoidvacuum(char*vacrel);
57+
externvoidvacuum(char*vacrel,boolverbose);
5858

5959

6060
#endif/* VACUUM_H */

‎src/include/nodes/parsenodes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: parsenodes.h,v 1.8 1996/12/17 01:53:43 momjian Exp $
9+
* $Id: parsenodes.h,v 1.9 1997/01/13 03:45:02 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -397,6 +397,7 @@ typedef struct ClusterStmt {
397397
*/
398398
typedefstructVacuumStmt {
399399
NodeTagtype;
400+
boolverbose;/* print status info */
400401
char*vacrel;/* table to vacuum */
401402
}VacuumStmt;
402403

‎src/man/vacuum.l

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/vacuum.l,v 1.2 1996/12/11 00:28:15 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/vacuum.l,v 1.3 1997/01/13 03:45:33 momjian Exp $
44
.TH VACUUM SQL 11/05/95 PostgreSQL PostgreSQL
55
.SH NAME
66
vacuum\(em vacuum a database
77
.SH SYNOPSIS
88
.nf
9-
\fBvacuum[table]\fP
9+
\fBvacuum[verbose][\fPtable\fB]\fP
1010
.fi
1111
.SH DESCRIPTION
1212
.BR Vacuum
@@ -18,6 +18,8 @@ tuples and number of pages stored in all classes. Running
1818
.BR vacuum
1919
periodically will increase Postgres's speed in processing user queries.
2020
.PP
21+
\fBverbose\fP prints a detailed vacuum activity report for each table.
22+
.PP
2123
The open database is the one that is vacuumed.
2224
.PP
2325
We recommend that production databases be vacuumed nightly, in order

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp