Re: Dates in Primary Keys/Unique Index
Posted in 1997
In article <01bc825c$42b520a0$ad1610a2@cassel>, Bob Carts <rcarts@agccs.lmco.com> writes >I have a task to crunch through a physical database created right out of >the ERWIN datamodeling tool. I have a few questions: > >1) Is there a problem/trade-offs using dates in a composite primary key? >For example where the primary key is CUSTOMER_NUM + CALL_DATE. > Generally composite primary keys are a bad idea, try adding a serial column to the table. You really want as small a join key as possible. >2) Does it make sense to put the CALL_DATE first if it would be more >selective than CUSTOMER_NUM? > Yes, the most selective column should be at the front of the index. >3) Are there any advantages/disadvantages of creating a unique index on a >column prior to making the same column a primary key? Yes, it means the index gets a meaningful name have that the default one provided by informix. (Informix uses unique indicies to enforce uniqueness on primary keys). NOTE: The default name generated by Informix will contain a space character which MS-ACCESS can not handle. > >I am using ODS 7.22 on SUN Solaris 2.5.1. I don't have alot of information >on performance requirements and usage patterns (not good) so I am looking >for general comments. Thanks! I'm using OWS 7.20 on Solaris 2.5.1... -- David Williams