[SQL] Warehouse Schema

2006-05-24 Thread Worky Workerson
I'm developing a schema for a large data warehouse (10 billion records) and had a couple of questions about how to optimize it.  My biggest question is on the design of the fact table and how much normalization I should actually do of the data.  The data is going to be keyed by IP address, stored

Re: [SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-24 Thread Richard Huxton
andi wrote: Dear friends, I have table MD_CUSTOMER MD_CUSTOMERIDPK integer primary key NAME varchar OK - two columns. But my primary key is not in correct order like MD_CUSTOMER MD_CUSTOMERIDPK NAME 10 ANDI 33 TESTER 100

Re: [SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-24 Thread Franco Bruno Borghesi
Well, you could add a serial column. I'll tell you how, but I haven't tested the code, so be sure to check it! And using BEGIN and COMMIT/ROLLBACK to delimit transactions would not be a bad idea at all ;-)To add a serial column, just write: --create new serial field ALTER TABLE md_customer ADD id

Re: [SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-24 Thread Andrew Sullivan
On Wed, May 24, 2006 at 05:35:10PM +0700, andi wrote: > > But my primary key is not in correct order like What does this mean? Is the key being generated by a sequence (i.e. is the column DEFAULT nextval('some_sequence'))? If so, the primary key will be assigned in COMMIT order. Note that the

[SQL] PLEASE help ME , HOW TO GENERATE PRIMARY Keys on the fly

2006-05-24 Thread andi
Dear friends,   I have table MD_CUSTOMER MD_CUSTOMERIDPK integer primary key NAME   varchar     But my primary key is not in correct order like MD_CUSTOMER MD_CUSTOMERIDPK NAME 10