Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A817C64FE5B for ; Wed, 15 Oct 2008 06:30:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 75067-01 for ; Wed, 15 Oct 2008 06:30:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 9AD4E64FE73 for ; Wed, 15 Oct 2008 06:30:47 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Kq2iJ-0007Kz-EW for pgsql-performance@postgresql.org; Wed, 15 Oct 2008 09:30:43 +0000 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Oct 2008 09:30:43 +0000 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Oct 2008 09:30:43 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Ivan Voras Subject: Re: Backup strategies Date: Wed, 15 Oct 2008 11:30:40 +0200 Lines: 64 Message-ID: References: <48F4D693.9000304@lerner.co.il> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9B612C82132EFCD270730CBB" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Thunderbird 2.0.0.17 (X11/20080925) In-Reply-To: <48F4D693.9000304@lerner.co.il> X-Enigmail-Version: 0.95.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200810/78 X-Sequence-Number: 31659 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9B612C82132EFCD270730CBB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Reuven M. Lerner wrote: > But before I do any of these things, I want to hear what others have > discovered in terms of high-performance backups. Is there a way to sto= p > pg_dump from locking up the database so much? Is there a knob that I > can turn to do a low-priority backup while the live site is running? I= s > there a superior backup strategy than pg_dump every 24 hours? If you are sysadmin-minded and your operating system & file system support snapshots, an easy solution (and the one I use) is to create a read-only snapshot of the file system with the (binary) database files and back that up. The approach has some benefits: * It won't interfere with "normal" database operations (no locking; though I'm not sure that locking is your problem here as pgsql uses MVCC)= * It works at disk speeds instead of converting data back to SQL for stor= age * Restoring the database works automagically - no need to import the data from SQL back * It's convenient to backup snapshots with usual file system backup utilities. Tar works fine. It also has some significant disadvantages: * The binary database representation is usually much larger than the SQL text one (because of indexes and internal structures). OTOH you can easily use tar with gzip to compress it on the fly. * Technically, the snapshot of the database you're taking represents a corrupted database, which is repaired automatically when it's restored. It's similar to as if you pulled the plug on the server while it was working - PostgreSQL will repair itself. * You cannot restore the database to a different version of PostgreSQL. The same rules apply as if upgrading - for example you can run data from 8.3.0 on 8.3.3 but not from 8.2.0 to 8.3.0. Warning: DO NOT do on-the-fly binary backups without snapshots. Archiving the database directory with tar on a regular file system, while the server is running, will result in an archive that most likely won't work when restored. --------------enig9B612C82132EFCD270730CBB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFI9bhAldnAQVacBcgRAjr1AKCZaNZ+/8Lxl6BN0QIYRzCzMH6/MgCgn+sr +ltu4olPYHflaXSnnTQHIJQ= =6Ono -----END PGP SIGNATURE----- --------------enig9B612C82132EFCD270730CBB--