Re: Temporary Table

Andrew McMillan <andrew@catalyst.net.nz>

From: Andrew McMillan <andrew@catalyst.net.nz>
To: "Christian Paul B. Cosinas" <cpc@cybees.com>
Cc: "'Joshua D. Drake'" <jd@commandprompt.com>, 'Alvaro Nunes Melo' <al_nunes@atua.com.br>, pgsql-performance@postgresql.org
Date: 2005-11-08T02:35:20Z
Lists: pgsql-performance
On Tue, 2005-11-08 at 10:22 +0000, Christian Paul B. Cosinas wrote:
> I see.
> 
> But How Can I put this in the Cron of my Linux Server?
> I really don't have an idea :)
> What I want to do is to loop around all the databases in my server and
> execute the vacuum of these 3 tables in each tables.

I usually write a small shell script something like:

==================================================
#!/bin/sh

psql somedatabase <<EOQ
  VACUUM this;
  VACUUM that;
  DELETE FROM someotherplace WHERE delete_this_record;
EOQ
==================================================

and so forth...

This makes the SQL quite nicely readable.


Regards,
					Andrew McMillan.

-------------------------------------------------------------------------
Andrew @ Catalyst .Net .NZ  Ltd,  PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/            PHYS: Level 2, 150-154 Willis St
DDI: +64(4)803-2201      MOB: +64(272)DEBIAN      OFFICE: +64(4)499-2267
            You work very hard.  Don't try to think as well.
-------------------------------------------------------------------------