FORCE INDEX

FORCE INDEX

FORCE INDEX:
It acts like USE INDEX (key_list) but with the addition that a table scan is assumed to be very expensive.A table scan is used only if there is no way to use one of the given indexes to find rows in the table.Force index does not work, if one would want MySQL to prefer full index scan instead of full table scan and file sort.

Example:

EXPLAIN SELECT * FROM tab1 force index(id) ORDER BY id;

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.