From: | Kuwamura Masaki <kuwamura(at)db(dot)is(dot)i(dot)nagoya-u(dot)ac(dot)jp> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | bug fix and documentation improvement about vacuumdb |
Date: | 2023-09-14 11:21:51 |
Message-ID: | CAMyC8qp9mXPQd5D6s6CJxvmignsbTqGZwDDB6VYJOn1A8WG38w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi there,
I have 1 trivial fix, 1 bug fix, and 1 suggestion about vacuumdb.
First, I noticed that the help message of `vacuumdb` is a bit incorrect.
`vacuumdb -?` displays the following message
```
...
-n, --schema=PATTERN vacuum tables in the specified schema(s)
only
-N, --exclude-schema=PATTERN do not vacuum tables in the specified
schema(s)
...
```
PATTERN should be changed to SCHEMA because -n and -N options don't support
pattern matching for schema names. The attached patch 0001 fixes this.
Second, when we use multiple -N options, vacuumdb runs incorrectly as shown
below.
```
$ psql
=# CREATE SCHEMA s1;
=# CREATE SCHEMA s2;
=# CREATE SCHEMA s3;
=# CREATE TABLE s1.t(i int);
=# CREATE TABLE s2.t(i int);
=# CREATE TABLE s3.t(i int);
=# ALTER SYSTEM SET log_statement TO 'all';
=# SELECT pg_reload_conf();
=# \q
$ vacuumdb -N s1 -N s2
```
We expect that tables in schemas s1 and s2 should not be vacuumed, while
the
others should be. However, logfile says like this.
```
LOG: statement: VACUUM (SKIP_DATABASE_STATS) pg_catalog.pg_proc;
LOG: statement: VACUUM (SKIP_DATABASE_STATS) pg_catalog.pg_proc;
...
LOG: statement: VACUUM (SKIP_DATABASE_STATS) s2.t;
LOG: statement: VACUUM (SKIP_DATABASE_STATS) s1.t;
LOG: statement: VACUUM (ONLY_DATABASE_STATS);
```
Even specified by -N, s1.t and s2.t are vacuumed, and also the others are
vacuumed
twice. The attached patch 0002 fixes this.
Third, for the description of the -N option, I wonder if "vacuum all tables
except
in the specified schema(s)" might be clearer. The current one says nothing
about
tables not in the specified schema.
Thoughts?
Masaki Kuwamura
Attachment | Content-Type | Size |
---|---|---|
v1-0001-vacuumdb-Fix-help-message.patch | application/octet-stream | 1.2 KB |
v1-0002-vacuumdb-Fix-bug-multiple-N-switches.patch | application/octet-stream | 1.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Jones | 2023-09-14 11:33:04 | Re: [PATCH] Add inline comments to the pg_hba_file_rules view |
Previous Message | Ashutosh Bapat | 2023-09-14 11:09:50 | Re: Reducing memory consumed by RestrictInfo list translations in partitionwise join planning |