I wrote: > * pg_clog is truncated according to the oldest pg_database.datvacuumxid.
While testing this patch I realized that there's a bit of an issue here. It's usually going to be the case that the oldest datvacuumxid is template0's, meaning that it will never be possible to truncate clog until autovacuum decides that template0 is at risk of wraparound and goes and vacuums it. Shortening the freeze horizon will reduce the size that pg_clog occupies just *after* that happens, but we're still going to see pg_clog bloating up to something close to 256MB before autovacuum kicks in. And there is nothing a user can do about it, unless he's willing to override the datallowconn = false safety cover on template0 so he can connect to it and vacuum it manually. This wasn't a problem in the pre-8.2 logic because we ignored non-connectable databases while determining the global minimum datvacuumxid, but it's a real problem now. Seems like either we go back to ignoring non-connectable databases (with the risks that entails), or adopt some more-aggressive policy for launching autovacuums on them, or give up the idea of keeping pg_clog small. A more-aggressive policy seems like the best option, but I'm not entirely sure what it should look like. Maybe force autovacuum when age(datvacuumxid) exceeds twice the freeze horizon, or some such? Comments? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match