Re: Table design question
Posted in 1999
Don Pritchard wrote: > > Hi All > > I've always battled against this one : > > If you were creating a staff table > > Would you have the following > > staff_id serial > fname char(20) > mname char(20) > lname char(20) > .. > .. > .. > > where obviously staff_id is the primary key > > *or* > > fname char(20) > mname char(20) > lname char(20) > .. > .. > .. > > Where the primary key is a combo of the first 3 fields > > The second is a bigger index but it dispenses with a code field. > > Any thoughts? I would definitely go with a surrogate key. It keeps the key (index) size down (4 bytes instead of 60) and improves performance. Which is exactly what the SERIAL type was designed for. Cheers, -- Mark. +----------------------------------------------------------+-----------+ |Mark D. Stock - Informix SA http://www.informix.com |//////// /| |mailto:mdstock@informix.com http://www.informix.com/idn |///// / //| |http://www.iiug.org +-----------------------------------+//// / ///| | Tel: +27 11 807 0313 |If it's slow, the users complain. |/// / ////| | Fax: +27 838250 2325 |If it's fast, the users keep quiet.|// / /////| |Cell: +27 83 250 2325 |Therefore, "No news: travels fast"!|/ ////////| +----------------------+-----------------------------------+-----------+