RE: primary key question
Posted in 1999
I would do "a" and "b". * Create an unique index on "id". * Create a primary key constraint on "id". It will share the unique index, which was created on "id". You could then create a foreign key constraint on the other (main) table which references the primary key of this table. You may also want a unique index on company and state. It would ensure uniqueness and allow searches for valid combinations. However, this index would be used to satisfy business requirements, rather than for performance purposes. Do experienced Informix DBAs agree? -----Original Message----- From: Yan Zhu [mailto:yan.zhu@infinity-insurance.com] Sent: Friday, January 22, 1999 12:26 To: informix-list@iiug.org Subject: primary key question hi all: I am building a index table which contains the following: id state company each record contains a unique combination of state and company, id is a type serial integer, state and company are chars. this table, and id will be used as foreign key in another table which contains main data. My question is, for best performance, do i: a). put a unique index on id b). put a primary key on id c). put a primary key on id,state and company d). put a primary key on id,state and company And a unique key on id. thanks a lot. yan