On Wed, Jun 16, 2021 at 03:27:21PM +0900, Kyotaro Horiguchi wrote: > > If we are willing to maintain the two methods. > Couldn't we just skip the checkpoints if the database is known to > "clean", which means no page has been loaded for the database since > startup? We can use the "template" mark to reject connections to the > database. (I'm afraid that we also should prevent vacuum to visit the > template databases, but...)
There's already a datallowconn for that purpose. Modifying template databases is a common practice and we shouldn't prevent that. But having the database currently doesn't accepting connection doesn't mean that there is no dirty buffer and/or pending unlink, so it doesn't look like something that could be optimized, at least for the majority of use cases.