Re: schema or database

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "Michael Cheung *EXTERN*" <vividy(at)justware(dot)co(dot)jp>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: schema or database
Date: 2015-04-13 08:48:48
Message-ID: CAFj8pRBUpHFA+4ggOoP=DZg7vJRZd4u817N37P5MFEOCkYRTSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2015-04-13 10:43 GMT+02:00 Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>:

> Michael Cheung wrote:
> > I have many similar database to store data for every customer.
> > Structure of database is almost the same.
> > As I use same application to control all these data, so I can only use
> > one database user to connect to these database.
> > And I have no needs to query table for different customer together.
> >
> > I wonder which I should use, different shema or different database to
> store data?
> >
> > I 'd like to know the advantage and disadvantage for using schema or
> database.
>
> In addition to what others have said:
>
> If you use multiple schemas within one database, the danger is greater that
> data are written to or read from the wrong schema if your application has
> a bug
> ans does not make sure to always set search_path or qualify every access
> with a
> schema name.
>
> With multiple databases you are guaranteed not to access data from a
> different
> database.
>
> The main downside that I see to multiple databases is the overhead: each of
> the databases will have its own pg_catalog tables.
>

It can be advantage - if your schema is pretty complex - thousands
procedures, tables, then separate pg_catalog can be better - there are
issues with pg_dump, pg_restore.

So it depends on catalog size and complexity.

Regards

Pavel

>
> Yours,
> Laurenz Albe
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Anil Menon 2015-04-13 11:21:32 Re: schema or database
Previous Message Albe Laurenz 2015-04-13 08:43:50 Re: schema or database