Re: Storage of Foreign Keys

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Alan Hodgson <ahodgson(at)simkin(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Storage of Foreign Keys
Date: 2009-09-21 17:44:15
Message-ID: dcc563d10909211044s659191dcuc49abf4d166dae43@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 21, 2009 at 11:09 AM, Alan Hodgson <ahodgson(at)simkin(dot)ca> wrote:
> On Monday 21 September 2009, Christian Koetschan
> <c(dot)koetschan(at)biozentrum(dot)uni-wuerzburg(dot)de> wrote:
>> Is everything I insert into mycolA and mycolB stored twice, or
>> is there something like a pointer/reference from mycolA to the things
>> stored in mycolB?
>>
>
> It's stored twice and for performance you need to index it in both tables.
> If you put ON UPDATE CASCADE on it, an update to the master will hit both
> tables though.

Slight correction. You might need to index it on both ends for
performance. There are some instances where the referencing table
only ever has a few rows in it, and in those cases, you likely don't
need an index.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vick Khera 2009-09-21 17:53:10 Re: VMWare file system / database corruption
Previous Message Scott Marlowe 2009-09-21 17:40:33 Re: VMWare file system / database corruption