On Wed, Jan 12, 2022 at 10:57 AM Peter Geoghegan <p...@bowt.ie> wrote: > > On Tue, Jan 11, 2022 at 4:59 PM John Naylor > <john.nay...@enterprisedb.com> wrote: > > I've attached a PoC *untested* patch to show what it would look like > > as a top-level statement. If the "shape" is uncontroversial, I'll put > > work into testing it and fleshing it out. > > Great!
+1 > > > For the PoC I wanted to try re-using existing keywords. I went with > > "VACUUM LIMIT" since LIMIT is already a keyword that cannot be used as > > a table name. It also brings "wraparound limit" to mind. We could add > > a single-use unreserved keyword (such as VACUUM_MINIMAL or > > VACUUM_FAST), but that doesn't seem great. > > This seems reasonable, but you could add a new option instead, without > much downside. While INDEX_CLEANUP kind of looks like a keyword, it > isn't really a keyword. (Perhaps you knew this already.) > > Making this a new option is a little awkward, admittedly. It's not > clear what it means to "VACUUM (LIMIT) my_table" -- do you just throw > an error for stuff like that? So perhaps your approach of adding > VacuumMinimalStmt (a minimal variant of the VACUUM command) is better. It seems to me that adding new syntax instead of a new option is less flexible. In the future, for instance, when we support parallel heap scan for VACUUM, we may want to add a parallel-related option to both VACUUM statement and VACUUM LIMIT statement. VACUUM LIMIT statement would end up becoming like VACUUM statement? As another idea, we might be able to add a new option that takes an optional integer value, like VACUUM (MIN_XID), VACUUM (MIN_MXID), and VACUUM (MIN_XID 500000). We vacuum only tables whose age is older than the given value. If the value is omitted, we vacuum only tables whose age exceeds a threshold (say autovacuum_freeze_max_age * 0.95), which can be used in an emergency case and output in GetNewTransactionID() WARNINGs output. vacuumdb’s --min-xid-age and --min-mxid-age can use this option instead of fetching the list of tables from the server. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/