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

Home -> Community -> Usenet -> c.d.o.misc -> Re: One sequence per table?

Re: One sequence per table?

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 24 Aug 2005 22:03:02 -0500
Message-ID: <u1x4ih7s3.fsf@rcn.com>


On Fri, 19 Aug 2005, nospam_at_dfs_.com wrote:
> I guess this is a matter of personal taste, but I usually create a
> SEQUENCE for each table that has an ID field I need to populate. I've
> seen others create one SEQUENCE to generate IDs for all the tables.
>
> I'm working on a new system, and I have 12 such tables, and I'm not
> sure I want to build 12 SEQUENCES.
>
> Any opinions?

The nice thing about one sequence for all ids is that refactoring your data model isn't as hard to do. Suppose after awhile you realize that two tables have commonality and you really want to have a higher-level table that has the common attributes and then the two tables are subtyped, meaning their PK is the Parent's PK. Having started with one sequences means that you won't have to put a type column on the supertype table to differentiate the ids. They are already unique because of the one sequence. All you have to do is create the supertype table, fill it with the distinct ids, update the common attributes correctly, remove the attributes from the subtypes and apply the FK relationships.

-- 
Galen deForest Boyer
Received on Wed Aug 24 2005 - 22:03:02 CDT

Original text of this message

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