From: | Bill Moran <wmoran(at)collaborativefusion(dot)com> |
---|---|
To: | a(dot)maclean(at)cas(dot)edu(dot)au |
Cc: | "Andrew Maclean" <andrew(dot)amaclean(at)gmail(dot)com>, General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Backing up and deleting a database. |
Date: | 2008-07-15 12:07:57 |
Message-ID: | 20080715080757.c1815b90.wmoran@collaborativefusion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In response to "Andrew Maclean" <andrew(dot)amaclean(at)gmail(dot)com>:
> We have a database that grows in size quite quickly. Of course we
> backup nightly and keep a weeks worth of data
>
> However we need to keep a few months data online, but the rest can be
> archived as it will be unlikley that it will be used again.
>
> As I see it we can:
> 1) Run a query to drop/delete old data, the downside here is that we lose it.
> 2) Stop the database (this is important because clients are writing to
> it), back it up, delete it and recreate the database. Has anyone done
> this? Do they have a script for this?
I'm confused. If you can't back up the data because clients are writing
to it, then it must be interesting to those clients, so why are you able
to delete it?
Would a script that does the following work:
1) BEGIN; CREATE TABLE stage_archive AS (SELECT * FROM ??? WHERE [some
where clause to identify old records]); DELETE FROM ??? WHERE [same
where clause]; COMMIT;
2) COPY stage_archive TO 'some_file.sql'
3) Back up or otherwise archive some_file.sql
4) DROP TABLE stage_archive;
--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/
wmoran(at)collaborativefusion(dot)com
Phone: 412-422-3463x4023
From | Date | Subject | |
---|---|---|---|
Next Message | Sergey Konoplev | 2008-07-15 12:28:06 | Re: Referential integrity vulnerability in 8.3.3 |
Previous Message | Morten Barklund | 2008-07-15 12:02:55 | Unicode database on non-unicode operating system |