Schema per user?

From: Anders Steinlein <anders(at)steinlein(dot)no>
To: pgsql-general(at)postgresql(dot)org
Subject: Schema per user?
Date: 2009-05-07 19:45:30
Message-ID: FC231040-97F0-42B5-970E-C1AA0F5ED2A6@steinlein.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm pondering a design question for a subscription-based web-app we
are developing. Would it be feasible to create a new schema per user
account, setting the search_path to their own schema during login?
There is no shared data (except where we keep a record of users), as
each account is entirely self-contained. I would usually just put
username into relevant tables and querying based on this, but I
figured separate schemas *might* have a few advantages: Ease scaling
by placing users across different tablespaces and/or databases, easier
backup/restore of specific user's data and no vacuum when we delete
accounts (just drop schema vs delete).

Has anyone done something like this, or is it simply A Bad Idea? How
many schemas can a database contain, until one hits a (hard or soft)
limit? Keep in mind that this is not a "regular" web-app with
thousands of users, but more in the range of 500-1000 for the
foreseeable future.

Regads,
Anders

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-05-07 20:05:59 Re: Schema per user?
Previous Message Scott Marlowe 2009-05-07 19:10:17 Re: Upgrading from postgres 8.1 to 8.3