Originally posted by Christo Kutrovsky:
Sorry about the delay
Don't be silly, here only Marco has deadlines.... How's 5.1.4 coming along?
Why concatenate date and sequence for PK?
So that you can partition by RANGE and to be able to do partition maintenance easily.
You will ask imediatelly why not use a date column, well .. because it's not the master table that is the problem, it's the details ones. So by partitioning the detail tables by the key, you automatically get (wihtout changing the app) partition elimation, and you get the benefit of been able to quickly drop old data.
Actually, my immediate would have been: why do you need a date to partition by range? You can do the same with a sequence, achieving the same partition elimination.
Now, the old data argument sways me more. However, I find that operational systems have the nasty habit that you cannot just cut off a whole partition when it is based on date only. The cut-off always seems to be on a date and a certain status code of the transaction and/or it's details, commonly the header status.
If you don't have that need, your approach would be just handy-dandy. I suggest using a Julian date though, less space, and easy for 90 days ago type calculations. We have YYYYMMDD here as well in places, and I regret not having converted it to Julian.
Hmmm, nice idea, but that will of course not work due to the concatenation. Two variable length numbers is rather yucky, as it can cause duplicates. OK, I see the need for the YYYYMMDDHH24MISS now: Chronology, with the sequence to make it unique. Did you look at the TIMESTAMP with the fractions of seconds? We currently haven't been able to get it to return duplicates, but then we're running a DW here, so not that many concurrent users on the same table..... Oh, well, so much for my ideas, enough rambling from me....
------------------
Hakuna Matata,
Arnoud.
[This message has been edited by aotte (edited 03 October 2003).]