Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Are primary keys always needed?
Primary keys are important. However, there are many arguments about primary
keys. Probably the most common is that the primary key should, in fact,
have no direct relation to the data it references while others argue that it
should.
You will find often that in tables that are functionally dependent on other
tables, that you cannot implement a primary key because the data in these
tables could not exist without the data from which the primary-foreign key
relationship ensues.
As far as 3rd normal form, it is a nice thought - in theory. However, I have yet to see a database of any size that comes near to adhering to this form. A large database would be far too sluggish if it were in 3rd normal form because too many joins would have to be done.
DB
Brian Peasland <peasland_at_email.msn.com> wrote in message
news:#JaNynzo#GA.171_at_cpmsnbbsa03...
> >1. Are there any cases in which a primary key is not required for a
> >table? Or, Is there any good justification for having a table with NO
> >primary key?
>
>
> A primary key (PK) is never required, but always desired. As many DBAs
say,
> "without PKs and corresponding foreign keys (FK), your database isn't very
> relational is it? "
>
> You can define tables without PKs. Besides uniquely identifying a record
in
> the table, they also help speed up your searches (if you are searching on
> the field). The only justification I've ever heard of not having a PK goes
> like this: When you have a PK, an index is created for that field. If you
> are inserting lots of records into a table in one mass operation, each
> record has to wait for the index to be updated before the next record can
be
> processed. To speed up the mass loading of these records, some DBAs find
it
> desireable to drop the PK constraint, load the records (they'll load much
> faster since they don't have to update the index), and then recreate the
PK
> constraint.
>
> I've also ignored PKs when creating quick, temporary tables.
>
> >2. If a data model as some tables with no primary keys, does this mean
> >that the model is NOT a GOOD data model, or is NOT AS GOOD AS it could
> >be?
>
>
> NOT AS GOOD AS IT COULD BE. This generally means that you haven't done a
> good job of normallizing your tables. I'm not a firm believer that every
> table should be in Third Normal Form, but you should strive for it unless
> reasons dictate otherwise.
>
> Hope this helps,
> Brian Peasland
> peasland_at_msn.com
>
>
Received on Thu May 20 1999 - 23:04:19 CDT
![]() |
![]() |