List:General Discussion« Previous MessageNext Message »
From:Dathan Vance Pattishall Date:July 10 2003 1:04am
Subject:Why is it better to have a composite key with the largest cardinality 1st?
View as plain text  
Say I have column A with 10000 distinct values column B and C with 2
distinct values and for simplicity sake the column type is an int.

If I wanted a composite key why should I make the order of the key
A,B,C
 
I read someplace that faster lookups happen with the leftmost index,
being an index with a large cardinality. Is this true? Is this a hook
for the optimizer? What is the internal logic for mySQL that makes this
so? Is this a myth and have I been misled?
 
--
Dathan
 


Thread
Why is it better to have a composite key with the largest cardinality 1st?Dathan Vance Pattishall10 Jul
RE: Why is it better to have a composite key with the largest cardinality 1st?Rudy Metzger10 Jul