FORCE is not part of the ANSI-SQL standard but appears in several dialects as a performance-tuning hint or DDL option. In MySQL and MariaDB, FORCE INDEX (or FORCE) can be added to SELECT/UPDATE/DELETE statements to require the optimizer to use one or more specified indexes. ALTER TABLE ... FORCE rebuilds a table and its indexes, similar to OPTIMIZE TABLE, which can reclaim space or defragment storage.In SQL Server, the OPTION (FORCE ORDER) query hint prevents the optimizer from reordering joins, while other hints such as FORCESEEK and FORCE SCAN push the engine toward a particular access method. Oracle uses the keyword in ALTER TABLE ... ENABLE VALIDATE CONSTRAINT ... FORCE to enable a disabled constraint that might otherwise fail.Because FORCE bypasses cost-based choices, use it only after profiling queries and ensuring the change improves performance. Over-using FORCE can backfire when data distributions or table sizes change.
USE INDEX, IGNORE INDEX, OPTIMIZE TABLE, ANALYZE TABLE, SQL Server query hints, Oracle optimizer hints
MySQL 4.0 (FORCE INDEX)
If the forced index better matches the filter conditions or provides a covering index, queries can speed up by orders of magnitude. Always benchmark both plans.
Use ALTER TABLE ... FORCE when OPTIMIZE TABLE is blocked, when you want to change the row format implicitly, or when you suspect corruption in the .ibd file.
No. Only one of USE INDEX, IGNORE INDEX, or FORCE INDEX may appear in the table hint list.
Hints are honored as long as the referenced index exists. However, the optimizer team may deprecate a hint in later releases, so review release notes before upgrading.