Index hints and plan verification

v4.2.5 table index hints use FROM table_name USE INDEX(index_name), FORCE INDEX(index_name) or IGNORE INDEX(index_name). Implementation validates names/scopes; USE and FORCE cannot be combined. Do not describe comment-style /*+ INDEX(...) */ or /*+ ORDERED */ as effective plan controls.

Reproducible example

DROP DATABASE IF EXISTS kernel_plan_518;
CREATE DATABASE kernel_plan_518;
USE kernel_plan_518;
CREATE TABLE customers(id INT PRIMARY KEY, region VARCHAR(10));
CREATE TABLE orders(id INT PRIMARY KEY, customer_id INT, amount DECIMAL(10,2));
CREATE INDEX idx_customer ON orders(customer_id);
INSERT INTO customers VALUES(1,'east'),(2,'west');
INSERT INTO orders VALUES(10,1,10.00),(11,1,20.00),(12,2,5.00);
EXPLAIN SELECT id FROM orders WHERE customer_id=1;
EXPLAIN SELECT id FROM orders FORCE INDEX(idx_customer) WHERE customer_id=1;
SELECT c.region,SUM(o.amount) AS total FROM customers c JOIN orders o ON c.id=o.customer_id GROUP BY c.region ORDER BY c.region;
DROP DATABASE kernel_plan_518;

The example creates its index and consistently names its table. Parsing EXPLAIN is only the first check: compare access paths and results. Configuration hints, table index hints and remap rewriting are different interfaces. See planning.

Source and regression entry points