Обсуждение: Foreign Keys Question

Поиск
Список
Период
Сортировка

Foreign Keys Question

От
Matthias Loitsch
Дата:
First of all, hi. I'm new to this mailing list.


I searched this on the net, but I didn't get any usable answers...


So here's my problem:

I have 2 schemas. One is called SITE, one SITE_forum.

What I wanted, is to separate the forum from the whole Site db, so I can
put them on different servers if I encounter performance problems or
anything.
So I started the SITE_forum schema, made all my tables, and realized,
that I don't want to create the table users in the schema SITE_forum,
because I want to use the exact same users than in the schema SITE.

One possibility would be, to create 2 identic tables on both schemas,
but that really really is not what I'd like to do.

So I thought I could make a foreign key on a different Schema (db), and
use the same table....

And well, thats where I started to search if this is possible ... and,
in fact my main question is: Is this a good idea?
I have no idea if this will be fast enough, or if I will have lots of
problems afterward....

Could anyone help me with this ?


Thanks in advance,
Matthias Loitsch



--
THEK
Matthias Loitsch
www.studiothek.com/


Вложения

Re: Foreign Keys Question

От
Bruno Wolff III
Дата:
On Wed, Apr 13, 2005 at 13:54:05 +0200,
  Matthias Loitsch <m@tthias.com> wrote:
>
> So I thought I could make a foreign key on a different Schema (db), and
> use the same table....
>
> And well, thats where I started to search if this is possible ... and,
> in fact my main question is: Is this a good idea?
> I have no idea if this will be fast enough, or if I will have lots of
> problems afterward....
>
> Could anyone help me with this ?

Schemas are just a name space, so using foreign keys accross schemas
shouldn't be a problem.

However, it you later put the contents of the schema on other server
or even in another database, then you are going to need to make a copy
of the data as you can't make foreign key references outside of
the current database.

Re: Foreign Keys Question

От
Oleg Bartunov
Дата:
Will inherits helps you ?

create table SITE_forum.t1 () inherits (SITE.t);


Oleg
On Wed, 13 Apr 2005, Matthias Loitsch wrote:

>
> First of all, hi. I'm new to this mailing list.
>
>
> I searched this on the net, but I didn't get any usable answers...
>
>
> So here's my problem:
>
> I have 2 schemas. One is called SITE, one SITE_forum.
>
> What I wanted, is to separate the forum from the whole Site db, so I can
> put them on different servers if I encounter performance problems or
> anything.
> So I started the SITE_forum schema, made all my tables, and realized,
> that I don't want to create the table users in the schema SITE_forum,
> because I want to use the exact same users than in the schema SITE.
>
> One possibility would be, to create 2 identic tables on both schemas,
> but that really really is not what I'd like to do.
>
> So I thought I could make a foreign key on a different Schema (db), and
> use the same table....
>
> And well, thats where I started to search if this is possible ... and,
> in fact my main question is: Is this a good idea?
> I have no idea if this will be fast enough, or if I will have lots of
> problems afterward....
>
> Could anyone help me with this ?
>
>
> Thanks in advance,
> Matthias Loitsch
>
>
>
>

     Regards,
         Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83