Re: Number of tables

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Mike Ivanov <mikei(at)activestate(dot)com>
Cc: fabio(dot)lafarcioli(at)molinoalimonti(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: Number of tables
Date: 2009-09-01 01:01:26
Message-ID: 407d949e0908311801w40889599s3e004588fba70428@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Sep 1, 2009 at 1:19 AM, Mike Ivanov<mikei(at)activestate(dot)com> wrote:
>> i am developing a web app for thousands users (1.000/2.000).
>>
>> Each user have a 2 table of work...I finally have 2.000 (users) x 2 tables
>> = 4.000 tables!
>
> As a someone with a ~50K-table database, I can tell you it's definitely
> possible to survive with such a layout :-)

The usual recommendation is to have a single table (or two tables in
this case) with userid forming part of the primary key in addition to
whatever identifies the records within the user's set of data. You may
not expect to be need to run queries which combine multiple users'
data now but you will eventually.

This doesn't work so great when each user is going to be specifying
their own custom schema on the fly but that's not really what
relational databases were designed for. For that you might want to
look into the hstore contrib module or something like CouchDB (which
can be combined with Postgres I hear)

--
greg
http://mit.edu/~gsstark/resume.pdf

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mike Ivanov 2009-09-01 01:10:39 Re: Number of tables
Previous Message Mike Ivanov 2009-09-01 00:19:01 Re: Number of tables