RE: Compound Primary Key question

2004-04-24 Thread Matt Chatterley
olumn as a PK. Cheers, Matt > -Original Message- > From: Jeremy Zawodny [mailto:[EMAIL PROTECTED] > Sent: 23 April 2004 23:51 > To: Emmett Bishop > Cc: [EMAIL PROTECTED] > Subject: Re: Compound Primary Key question > > On Fri, Apr 23, 2004 at 03:40:43PM -0700, E

Re: Compound Primary Key question

2004-04-23 Thread Jeremy Zawodny
On Fri, Apr 23, 2004 at 03:40:43PM -0700, Emmett Bishop wrote: > Quick question. In general, is it better to create > compound primary keys or use an auto increment field > to uniquely identify each record? Yes. It depends on your application and your data. Jeremy -- Jeremy D. Zawodny | Pe

Re: compound primary key

2002-01-23 Thread Jeremy Zawodny
On Tue, Jan 22, 2002 at 10:19:46AM +0100, Roger Baklund wrote: > > Just to make it clear: this is the primary key, and all four parts > of the index are needed to identify the row. Most of the time I use > the three first parts, sometimes I use all four parts, and sometimes > I use only the first

RE: compound primary key

2002-01-22 Thread Roger Baklund
> Hi, Hi, thank you for your reply. > Since b can have only two values, making it the first column in the > index columns will not be efficient, Why? > but since b is many distinct values ...I suppose you mean 'a'... > ordering on this key first makes sense. Also you are always > querying w

RE: compound primary key

2002-01-22 Thread Roger Baklund
* Jeremy Zawodny > On Mon, Jan 21, 2002 at 05:18:35PM +0100, Roger Baklund wrote: > > Hi, > > > > Also, I wonder what is the best order for my primary keys: > > > > a intThis is the 'main' id, very many distinct values > > b tinyintThis is a source code, possible values are 1 or 2 > >

Re: compound primary key

2002-01-21 Thread Jeremy Zawodny
On Mon, Jan 21, 2002 at 05:18:35PM +0100, Roger Baklund wrote: > Hi, > > Also, I wonder what is the best order for my primary keys: > > a intThis is the 'main' id, very many distinct values > b tinyintThis is a source code, possible values are 1 or 2 > c smallint Some counter > d t

Re: compound primary key

2002-01-21 Thread Anvar Hussain K.M.
Hi, A compound index creates an index in the order specified. If key is (a,b,c,d) then the index is in the order a,b,cd. That is the index file keeps these columns ordered with a pointer to the actual row in the data table. Since b can have only two values, making it the first column in the in