Re: pg_dump in stand alone backend - Mailing list pgsql-general

From Ulrich Wisser
Subject Re: pg_dump in stand alone backend
Date
Msg-id 4129CDC3.9000300@relevanttraffic.se
Whole thread Raw
In response to Re: pg_dump in stand alone backend  (Daniel Martini <dmartini@uni-hohenheim.de>)
List pgsql-general
Daniel Martini wrote:

> Hi,
>
> Citing Ulrich Wisser <ulrich.wisser@relevanttraffic.se>:
>
>>I would like to stop the postmaster every night and run
>>
>>vacuum
>>pg_dump
>>reindex
>>
>>in the stand alone backend.
>>
>>Vacuum and reindex seem to be quite easy, as I can setup a small script
>>with both commands. But what about pg_dump. That seems "somewhat" more
>>complex.
>
>
> What exactly is your problem about putting pg_dump in a (shell)script as
> well?

psql will not work without postmaster running. But if I let postmaster
run some other tools will connect to it and I can't get exclusive locks
on all tables for "vacuum full" and "reindex". With vacuum and reindex
I can do

#!/bin/bash
postgres -d /var/lib/pgsql/data -U xxx -O -P mydb < SQL
REINDEX DATABASE mydb
REINDEX TABLE t1 FORCE
REINDEX TABLE t2
...
REINDEX TABLE tn
VACUUM FULL VERBOSE ANALYZE
<<SQL

which will speed up my database on a daily basis at least by factor 5.
For security reasons I would also like to take a backup and I guess it
will be much faster in the stand alone backend.

Ulrich



pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: view triggers/procedures
Next
From: "SVGK, Raju (Raju)"
Date:
Subject: Re: view triggers/procedures