Re: A few new options for vacuumdb
Nathan Bossart <bossartn@amazon.com>
From: "Bossart, Nathan" <bossartn@amazon.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Robert Haas <robertmhaas@gmail.com>,
"pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2019-01-24T00:49:28Z
Lists: pgsql-hackers
Attachments
- v5-0001-Add-tests-for-using-vacuumdb-with-column-lists-pr.patch (application/octet-stream) patch v5-0001
- v5-0002-Export-split_table_columns_spec-for-use-in-vacuum.patch (application/octet-stream) patch v5-0002
- v5-0003-Always-use-a-catalog-query-to-discover-tables-to-.patch (application/octet-stream) patch v5-0003
- v5-0004-Add-min-xid-age-and-min-mxid-age-options-to-vacuu.patch (application/octet-stream) patch v5-0004
On 1/22/19, 7:41 PM, "Michael Paquier" <michael@paquier.xyz> wrote: > I have been looking at 0002, and I found a problem with the way > ANALYZE queries are generated. For example take this table: > CREATE TABLE aa1 (a int); > > Then if I try to run ANALYZE with vacuumdb it just works: > $ vacuumdb -z --table 'aa1(b)' > vacuumdb: vacuuming database "ioltas" > > Note that this fails with HEAD, but passes with your patch. The > problem is that the query generated misses the lists of columns when > processing them through split_table_columns_spec(), as what is > generated is that: > VACUUM (ANALYZE) public.aa1; > > So the result is actually incorrect because all the columns get > processed. > > This patch moves the check about the existence of the relation when > querying the catalogs, perhaps we would want the same for columns for > consistency? Or not. That's a bit harder for sure, not impossible > visibly, still that would mean duplicating a bunch of logic that the > backend is doing by itself, so we could live without it I think. Oh, wow. Thanks for pointing this out. I should have caught this. With 0002, we are basically just throwing out the column lists entirely as we obtain the qualified identifiers from the catalog query. To fix this, I've added an optional CTE for tracking any provided column lists. v5-0001 is your test patch for this case, and v5-0002 splits out the work for split_table_columns_spec(). Nathan
Commits
-
Add --min-xid-age and --min-mxid-age options to vacuumdb
- 00d1e88d3668 12.0 landed
-
Do not filter by relkind in vacuumdb's catalog query if --table is used
- b8f73df0f845 12.0 landed
-
Use catalog query to discover tables to process in vacuumdb
- e0c2933a767c 12.0 landed
-
Add TAP tests for vacuumdb with column lists
- 0803b0ae1ed6 12.0 landed
-
Make vacuumdb test regex more modular for its query output
- adaaacae658e 12.0 landed
-
Adjust documentation for vacuumdb --disable-page-skipping
- efab708997dc 12.0 landed
-
Add --disable-page-skipping and --skip-locked to vacuumdb
- 354e95d1f212 12.0 landed