I don't think so. Based on what I've read, MySQL always assumes and
equal distribution of data for an index. Based on this assumption it
may determine that it's just not worth it to use the index, like if
your search will return most of the records. You should periodically
optimize your indexes, at which time MySQL will reevaluate the
distribution of data and thus it's optimization rules.
You can optimize you indexes with the myisamchk command and the
--analyze parameter. If you are using InnoDB tables, I don't think
there is a way to do this.
On Thursday, September 11, 2003, at 01:30 PM, Tongprasith, Anan wrote:
> I have two tables which are exactly the same but have different set of
> data on them. I wrote a query and used EXPLAIN to see how it would run
> on each table.
> It turn out that the same query will use index on one table but not
> the other. So I delete all data on the "bad" table (the one that won't
> use index) and copy data from the "good" table over.
> Now it says it will use index. Is this a bug?
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments