Jump to content

Hint (SQL)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Addbot (talk | contribs) at 15:06, 10 March 2013 (Bot: Migrating 2 interwiki links, now provided by Wikidata on d:q3135775). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In database query operations, various SQL implementations use hints as additions to the SQL standard that instruct 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 to use an index (even if the query optimizer would decide otherwise).

Implementation

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 affecting SQL compatibility.[2]

See also

References