From: Michael Widenius Date: March 2 2009 9:26pm Subject: re: how to force index using. List-Archive: http://lists.mysql.com/internals/36322 Message-Id: <18860.20200.624238.559170@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "forbbs" == forbbs forbbs 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