Forum: Ruby on Rails postgresql utilities

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Craig W. (Guest)
on 2007-03-09 04:19
(Received via mailing list)
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
Craig W. (Guest)
on 2007-03-10 03:36
(Received via mailing list)
On Thu, 2007-03-08 at 19:16 -0700, Craig W. wrote:
> 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?
----
no one? Am I the first to consider this or is this not ruby material?

Craig
Michael S. (Guest)
on 2007-03-10 11:25
(Received via mailing list)
On Friday 09 March 2007, Craig W. wrote:
> 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

--
Michael S.
mailto:removed_email_address@domain.invalid
http://www.schuerig.de/michael/
Jeremy K. (Guest)
on 2007-03-10 11:58
(Received via mailing list)
On 3/10/07, Michael S. <removed_email_address@domain.invalid> wrote:
> 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.

jeremy
Craig W. (Guest)
on 2007-03-10 18:29
(Received via mailing list)
On Sat, 2007-03-10 at 01:57 -0800, Jeremy K. wrote:
> On 3/10/07, Michael S. <removed_email_address@domain.invalid> wrote:
> > 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 know, but I'm using CentOS 4.4 and it is still PostgreSQL 7.4.x

Craig
Craig W. (Guest)
on 2007-03-10 18:36
(Received via mailing list)
On Sat, 2007-03-10 at 10:24 +0100, Michael S. wrote:
> 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.
----
I do a full dump every night but I'm thinking that it would be nice to
have a table by table backup on demand because even though I try to
thoroughly test every thing before I migrate code into production, I do
have occasions where I have to tweak production code and I was thinking
that these types of on demand backups would be nice without having to
fire up something else (like pgadmin or phppgadmin).

I have already created a mini-controller for utilities to do things like
expire cached pages and was simply thinking of adding some postgresql
functionality.
----
> # Run VACUUM ANALYSE on all databases every 5 hours if pg_autovacuum is
> # 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
----
thanks

Craig
peter royal (Guest)
on 2007-03-10 20:12
(Received via mailing list)
On Mar 10, 2007, at 8:27 AM, Craig W. wrote:
>> Plus, PostgreSQL 8.x autovacuums.
> ----
> I know, but I'm using CentOS 4.4 and it is still PostgreSQL 7.4.x

upgrade. Postgres 8.x is much faster.

-pete
(Guest)
on 2007-03-11 02:23
(Received via mailing list)
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
(Guest)
on 2007-03-11 02:28
(Received via mailing list)
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...

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,
Craig W. (Guest)
on 2007-03-11 03:41
(Received via mailing list)
On Sat, 2007-03-10 at 16:28 -0800, removed_email_address@domain.invalid wrote:
> 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...
>
> 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".
----
that might be good enough for my purposes...thanks

Craig
This topic is locked and can not be replied to.