List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:March 2 2009 9:26pm
Subject:re: how to force index using.
View as plain text  
Hi!

>>>>> "forbbs" == forbbs forbbs <bbsexclusive@stripped> writes:

forbbs> I give lying information in the info() function and records_in_range()
forbbs> to force the query using index.
forbbs> For example: 'id' is key. When the query is like 'select ... from ..
forbbs> where id = 5', the index is used. But when it comes to range query
forbbs> like ''select ... from .. where id > 5', full table scan is used.

The scan is used if the query is likely to touch more than 30 % of the
table (because in this case the table scan is usually faster than the
index scan).

The following manual entry tells you how to force the index:

http://dev.mysql.com/doc/refman/5.1/en/index-hints.html

See the entry regarding FORCE INDEX.

Regards,
Monty
Thread
how to force index using.forbbs forbbs2 Mar
  • re: how to force index using.Michael Widenius2 Mar