why use SCHEMA? any real-world examples?

Поиск
Список
Период
Сортировка
От Net Virtual Mailing Lists
Тема why use SCHEMA? any real-world examples?
Дата
Msg-id 20041125084240.29603@mail.net-virtual.com
обсуждение исходный текст
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: "ON.KG"
Дата:
Сообщение: Trigger before insert
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: why use SCHEMA? any real-world examples?