Marc Slemko wrote:
On Thu, 26 Feb 2004, Keith Thompson wrote:


Given these two tables:

   create table t1 (
      id int unsigned auto_increment,
      a int,
      ... [other fields]
      primary key (id),
      index aid (a,id)
   ) type=innodb;

   create table t2 (
      id int unsigned,
      b int,
      ... [other fields]
      index id (id),
      index bid (b,id)
   ) type=innodb;

Using searches of the form:
  select *
  from t1, t2
  where t1.id = t2.id
  and t1.a = somevalue
  and t2.b = somevalue


It may well change its perspective and decide to use the index automatically if I actually had more columns in the table, or had data in it, but I don't know offhand if it is smart enough for that...


Should be. FORCE is helpful only in situations when the optimizer make the wrong guess about the key distribution and prefers the wrong index or no index at all. Those situations are relatively rare although I would guess we have some people on the list who have it happen in their application more often than they would like.


--
Sasha Pachev
Create online surveys at http://www.surveyz.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to