Hi,

I have some compound primary keys, all integer fields (a,b,c,d). In one
table we have by mistake made the key (b,a,c,d). We allways use at least
field a and field b in all lookups, and it seems to be working, but I wanted
to ask: does it matter? Should we change the 'wrong' primary key to
(a,b,c,d)? (Will mysql perform better/faster?)

Also, I wonder what is the best order for my primary keys:

a int        This is the 'main' id, very many distinct values
b tinyint    This is a source code, possible values are 1 or 2
c smallint   Some counter
d tinyint    Another counter

  or

b tinyint    This is a source code, possible values are 1 or 2
a int        This is the 'main' id, very many distinct values
c smallint   Some counter
d tinyint    Another counter

Which will perform faster, when all lookups use both a and b?

--
Roger


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to