10.2.1.23 Avoiding Full Table Scans (original) (raw)

The world's most popular open source database

10.2.1.23 Avoiding Full Table Scans

The output from EXPLAIN showsALL in thetype column when MySQL uses afull table scan to resolve a query. This usually happens under the following conditions:

For small tables, a table scan often is appropriate and the performance impact is negligible. For large tables, try the following techniques to avoid having the optimizer incorrectly choose a table scan:

SELECT * FROM t1, t2 FORCE INDEX (index_for_column)  
  WHERE t1.col_name=t2.col_name;  

See Section 10.9.4, “Index Hints”.