On 06/23/2011 09:37 AM, Natusch, Paul wrote:
Tablespaces are not useful for implementing this idea yet.
Loss of the pg_xlog subdirectory and the WAL contained in it normally results in catastrophic database failure. Recommended practice is to use a RAID-1 volume to make odds of that failure lower.
PostgreSQL can't be expected to operate sanely when faced with the loss of an individual tablespace. It may be possible to recover from it, but you'll be doing something it's not designed to handle, and that effort may not succeed. Note that any tablespace failure is likely to require taking down the database to repair the involved tablespaces, so you're likely to have downtime between a component failure and when you notice to take action. The database really does not like having tablespaces just go away in the middle of operations. PostgreSQL 9.1 (not released yet, currently in beta) includes a new feature called "unlogged tables" that might make this sort of deployment possible. If you created a tablespace for disposable data and put an unlogged table onto it, loss of that tablespace would me much less likely to cause a problem. So long as you recreated a new space for the unlogged table after restarting, you could probably recover having only lost the data on the crashed disk in this situation.
On a cheap server I can easily RAID-1 mirror a pair of drives on Linux using software RAID, and individual drives are $50 to $100 each. If your data isn't worth that much, And even that's not enough to really make me feel secure about the data--you really need to keep another copy around as a backup, too. You can treat your data as disposable and expect to lose it when any single component fails, or you can include some good redundancy practices in the design to reduce odds of a failure. There really isn't really a good solution providing partial protection in the middle of those two. -- Greg Smith 2ndQuadrant US greg@xxxxxxxxxxxxxxx Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books |