Re: Further thoughts on Referential Integrity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joel Burton" <joel(at)joelburton(dot)com>
Cc: "Wm(dot) G(dot) Urquhart" <wgu(at)wurquhart(dot)co(dot)uk>, "PostgreSQL General Forum" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Further thoughts on Referential Integrity
Date: 2002-05-20 15:12:58
Message-ID: 22669.1021907578@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Joel Burton" <joel(at)joelburton(dot)com> writes:
> So, I'd say you _still_ have three options:

> * use NULLs (which will be slower by a bit when the index is being used),

> * use an orphanage (which will be slower by a __tiny__ bit for all selects,
> because you'll be adding one more exclusion to your WHERE clause)

> * or re-write RI (which will be much slower for INSERTs, DELETEs, UPDATEs,
> and might be a bit more of a pain to port to other systems or maintain).

There's also option 4:

* use NULLs, and make a partial index using "WHERE foo IS NULL" to
catalog the rows containing nulls.

The cost of maintaining the extra index wouldn't be worth it unless
looking for the null rows is done very frequently ... but it is another
option to consider.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-05-20 15:23:19 Re: On using "date 'XXX' + interval 'XXX'" vs "date 'XXX'"
Previous Message Jon Lapham 2002-05-20 14:56:58 On using "date 'XXX' + interval 'XXX'" vs "date 'XXX'"