Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Design question : Nullable FK & FK To Unique Key

Re: Design question : Nullable FK & FK To Unique Key

From: <afatkulin_at_gmail.com>
Date: 9 Nov 2006 15:45:42 -0800
Message-ID: <1163115942.628755.249310@h54g2000cwb.googlegroups.com>


"""krislioe_at_gmail.com ΠΙΣΑΜ(Α):
"""
> Hi,
>
> >1. Generally the same as having index on nullable columns.
> This is FTS issue right ? I try not use two different tables because
> all other attributes is the same except for this nullable column, what
> is other solution to this condition ?
>
> > 2. Why? Why do you use unique constraint in place of PK?
> Because I use Surrogate Key as PK and natural Key as Unique constraint,
> and when doing data entry user is using natural Key.
>
> Thank you,
> xtanto

  1. Considering what null values are not stored in B*Tree indexes. As long as you gonna ask "what invoices is without orders" - you're going ahead to FTS. This can be avoided with bitmap indexes (however it would not be very appropriate for unique column unless the majority of your values are null). Another solution is to use function based index (for example nvl(order_id, -1) ) or some surrogate order id (for example -1 mean "no order"). Another thing to consider - when joining invoices with orders your probably would need to use outer join - this can eliminate access paths from the optimizer.
  2. Still can't see the point. If you have PK - you have PK. Why do you hiding the fact what you have PK under unique constraint?
Received on Thu Nov 09 2006 - 17:45:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US