I didn't say consider a table with a thousand rows, must have been someone elses response. But anyway, it comes down to knowing your
data. If you know your data, then you can create the best set of indexes.
I would almost never create an index on a field with a cardinality of 2. However, I would most likely create a compound index that
would include that field and others. Knowing which fields to includes under a single index requires knowing the data.
Just index everything is probably and ok policy for many of the databases out there. But when you are adding/updating millions of
records a day, performance is a concern. Indexing everything with have a noticeable slow down on inserts, updates and deletes
because all the indexes also need to be updated.
----- Original Message -----
From: "Philip Mather" <[EMAIL PROTECTED]>
To: "Brent Baisley" <[EMAIL PROTECTED]>
Cc: "Ratheesh K J" <[EMAIL PROTECTED]>; <mysql@lists.mysql.com>
Sent: Friday, August 04, 2006 1:31 PM
Subject: Re: Another question on Cardinality??
Brent,
Given that...
You really have to match cardinality with distribution of values.
...sounds like hard work (well you actually have to think about it) and...
considering all the above cases, what should I conclude? should I have indexes
on these three fields?
Looking for a specific answer than a "depend on situation" kind of an answer.
Frankly I'd ask "Why shouldn't I be indexing these fields?" not the other way around, you said to consider a table with only a
thousand rows right? Unless I'm missing something an index would cost a trivial amount of disk space. If the real case is 10's of
millions rows then compared to the data set it's still going to trivial anyway. Just index everything and throw some more hard
drives at it.
As someone else pointed out however there's plenty of comparative info all over the web let alone MySQL's own site, you could
probably find some approximate numbers to play with out there.
Regards,
Phil
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]