Re: key question

2001-10-31 Thread Jeremy Zawodny
On Wed, Oct 31, 2001 at 10:49:12PM +, Federico Schwindt wrote: > > thanks for the reply. it seems to be clear now. > > > MySQL Doesn't allow you to specifiy which index to use - it chooses > > (sometimes badly) whether or not to use one. > > From documentation: > > As of MySQL Versi

Re: key question

2001-10-31 Thread Federico Schwindt
Rick Emery wrote: > > First: I believe this is not legal (looking at myySQL manual p 6.5.3): > PRIMARY KEY (key1), KEY (key2) > You may use one or the other. yup, it does work here, ver 3.23.42. > Second: You may search by either owner_id or customer_id without creating an > index. > Such as

Re: key question

2001-10-31 Thread Federico Schwindt
thanks for the reply. it seems to be clear now. > MySQL Doesn't allow you to specifiy which index to use - it chooses > (sometimes badly) whether or not to use one. From documentation: As of MySQL Version 3.23.12, you can give hints about which index MySQL should use when retrieving i

Re: key question

2001-10-31 Thread Bill Adams
Federico Schwindt wrote: > hi, > > i'm not sure if this belongs here, but i cannot seem to find the > answer anywhere else. > first, what's the difference between: > > PRIMARY KEY (key1, key2) > PRIMARY KEY (key1), KEY (key2) The first line creates a single, unique key on the columns key

RE: key question

2001-10-31 Thread Quentin Bennett
Hi, In the first key, the combination of key1 and key2 must be unique, in the second, key1 must be unique on its own, but key2 does not need to be. Also, using the first primary key a select col1, col2, ... where key2=value cannot use the index but select col1, col2, ... where key1=value can

Re: key question

2001-10-31 Thread Paul DuBois
At 9:57 PM + 10/31/01, Federico Schwindt wrote: >hi, > > i'm not sure if this belongs here, but i cannot seem to find the >answer anywhere else. > first, what's the difference between: > > PRIMARY KEY (key1, key2) This creates an index within which pairs of key1/key2 values are unique.

RE: key question

2001-10-31 Thread Rick Emery
First: I believe this is not legal (looking at myySQL manual p 6.5.3): PRIMARY KEY (key1), KEY (key2) You may use one or the other. Second: You may search by either owner_id or customer_id without creating an index. Such as: SELECT * FROM mytable WHERE owner_id=123; -Original Message- F