postgresql utilities

I'm thinking that it would be very attractive to have some methods in
place that would do things like pg_dump on a per table basis and do
things like vacuum but I would want standard out directed to the screen
so I could see the effects.

I haven't found any plugins that do things like that - does anyone have
any direction/suggestions?

Craig

I'm thinking that it would be very attractive to have some methods in
place that would do things like pg_dump on a per table basis and do
things like vacuum but I would want standard out directed to the screen
so I could see the effects.

I haven't found any plugins that do things like that - does anyone have
any direction/suggestions?

Well, why would you need it? I'm using PostgreSQL myself and I don't
have a use for this functionality. What's the purpose of dumping a
single table? For backups, I dump the entire database. For export, I
use CSV or XML. I'm not saying that you're trying to do something
wrong, but simply that I don't understand what it is you want to
achieve.

Regarding vacuum(ing), I think this is not a task that Rails should care
about. This is a task that your PostgreSQL installation should handle
with the help of cron jobs. As a matter of fact, that's just how it
works on Debian. Below is an excerpt
from /etc/cron.d/postgresql-common.

Michael

# Run VACUUM ANALYSE on all databases every 5 hours if pg_autovacuum is
not
# running
2 0,5,10,15,20 * * 1-6 root if [ -x /usr/sbin/pg_maintenance ];
then /usr/sbin/pg_maintenan
ce --analyze >/dev/null; fi

# On Sunday you may wish to run a VACUUM FULL ANALYSE as well
# If you do not run a 24/7 site, you may want to uncomment the next line
# so as to do a regular VACUUM FULL. If you need 24/7 connectivity,
save
# VACUUM FULL for when you think you really need it.
10 3 * * Sun root if [ -x /usr/sbin/pg_maintenance ];
then /usr/sbin/pg_maintenance --full
--analyze >/dev/null; fi

Plus, PostgreSQL 8.x autovacuums.

jeremy

> Regarding vacuum(ing), I think this is not a task that Rails should care
> about. This is a task that your PostgreSQL installation should handle

Plus, PostgreSQL 8.x autovacuums.

> I'm thinking that it would be very attractive to have some methods in
> place that would do things like pg_dump on a per table basis and do
> things like vacuum but I would want standard out directed to the
> screen so I could see the effects.
>
> I haven't found any plugins that do things like that - does anyone
> have any direction/suggestions?

Well, why would you need it? I'm using PostgreSQL myself and I don't
have a use for this functionality. What's the purpose of dumping a
single table? For backups, I dump the entire database. For export, I
use CSV or XML. I'm not saying that you're trying to do something
wrong, but simply that I don't understand what it is you want to
achieve.

upgrade. Postgres 8.x is much faster.

-pete

Jumping on the "upgrade to PostgreSQL 8" bandwagon:

$ pg_dump --help |grep table
  -t, --table=TABLE dump the named table only
$ pg_dump --version
pg_dump (PostgreSQL) 8.1.8

-molecule

Also, there's a plugin that does this on a per-Model, db-agnostic
basis in Rails:

Dump or Slurp YAML Reference Data (and Fixtures)
http://nubyonrails.com/articles/2005/12/27/dump-or-slurp-yaml-reference-data

It's very handy for dumping and loading data in Rails. It plugs into
Rake now via "rake db:data:dump" and "rake db:data:load".

cheers,

Also, there's a plugin that does this on a per-Model, db-agnostic
basis in Rails:

Dump or Slurp YAML Reference Data (and Fixtures)
http://nubyonrails.com/articles/2005/12/27/dump-or-slurp-yaml-reference-data

It's very handy for dumping and loading data in Rails. It plugs into
Rake now via "rake db:data:dump" and "rake db:data:load".