Jump to content

Hint (SQL)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nikola Smolenski (talk | contribs) at 17:10, 26 November 2008 (Created page with 'In various SQL implementations, a '''hint''' is an addition to the SQL standard that instructs the database engine on how to execute the query. For example,...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

In various SQL implementations, a hint is an addition to the SQL standard that instructs the database engine on how to execute the query. For example, a hint may tell the engine to use as little memory as possible (even if the query will run slowly), or to use or not use an index even if the query optimizer would decide otherwise.

Different database engines use different approaches in implementing hints. MySQL uses its own extension to the SQL standard, where a table name may be followed by USE INDEX, FORCE INDEX or IGNORE INDEX keywords[1]. Oracle implements hints by using specially crafted comments in the query that begin with a + symbol, thus not influencing SQL compatibility[2].

See also

References

  1. ^ MySQL 5.0 Reference Manual: 12.2.8.2 Index Hint Syntax
  2. ^ Mike Ault: Oracle SQL Hints Tuning