Keith Keller wrote:
 >
 > I run a perl script that selects the existing databases from, uh,
 > pg_database, I think, and then runs a vacuum command on
 > each.  It's klunky, but it works.  If anyone is interested, let
 > me know and I'll post and/or mail it.  (It uses the perl Pg
 > module, which I believe comes with 6.5.)
 
 Try the following one-liner (yes, one liner. e-mail will break it up,
 and the syntax is kindof picky -- xargs is a great tool, even if it is
a
 little farkled):
 
 psql -t -c "select datname from pg_database" template1|xargs -n 1 psql
 -q -c "vacuum analyze"
 
 This produces a list of the database names, strips the column header
and
 row count, feeds it into xargs, which will feed each argument one at a
 time (-n 1) to the vacuum script. This script is going in my crontab
 tonight... ;-)
 
 Lamar Owen
 WGCR Internet Radio

Reply via email to