why use SCHEMA? any real-world examples?

From: "Net Virtual Mailing Lists" <mailinglists(at)net-virtual(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: why use SCHEMA? any real-world examples?
Date: 2004-11-25 08:42:40
Message-ID: 20041125084240.29603@mail.net-virtual.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am in the middle of a project to convert non-schema databases to a
schema-based system. The main reason I am doing it is because I need to
do a join on tables between databases, which can only be done with an
contrib module which does not have all the "features" one might want
(such as use of indexes, etc).

For example:

SELECT a.id, b.name FROM schema1.industry_id a, schema_shared.industries
b WHERE a.industry_id = b.industry_id;
SELECT a.id, b.name FROM schema2.industry_id a, schema_shared.industries
b WHERE a.industry_id = b.industry_id;
SELECT a.id, b.name FROM schema3.industry_id a, schema_shared.industries
b WHERE a.industry_id = b.industry_id;
SELECT a.id, b.name FROM schema4.industry_id a, schema_shared.industries
b WHERE a.industry_id = b.industry_id;
.. etc...

Obviously this prevents replicating "schema_shared" into every database
whenever it gets updated...

I am sure there are many other uses - they seem very flexible to me so
far, but that's what I'm using it for...

- Greg

>I just noticed PostgreSQL's schemas for my first time.
>(http://www.postgresql.org/docs/current/static/ddl-schemas.html)
>
>I Googled around, but couldn't find any articles describing WHY or
>WHEN to use schemas in database design.
>
>Since the manual says HOW, could anyone here who has used schemas take
>a minute to describe to a newbie like me why you did? What benefits
>did they offer you? Any drawbacks?
>
>Thanks for your time.
>
>- Miles

Browse pgsql-general by date

  From Date Subject
Next Message Markus Wollny 2004-11-25 09:15:56 Re: why use SCHEMA? any real-world examples?
Previous Message Klint Gore 2004-11-25 07:08:30 Re: [PERFORM] HELP speed up my Postgres