Hint (SQL)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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 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 <templatestyles src="Mono/styles.css" />USE INDEX, <templatestyles src="Mono/styles.css" />FORCE INDEX or <templatestyles src="Mono/styles.css" />IGNORE INDEX keywords.[1]
  • Oracle implements hints by using specially-crafted comments in the query that begin with a <templatestyles src="Mono/styles.css" />+ symbol, thus not affecting SQL compatibility.[2]
  • EDB Postgres Advanced Server (a proprietary version of PostgreSQL from EnterpriseDB) offers hints compatible with those of Oracle.[3][4]
  • Microsoft SQL Server offers hints via the <templatestyles src="Mono/styles.css" />OPTION keyword [5]

See also

References

<templatestyles src="Reflist/styles.css" />

  1. MySQL 5.5 Reference Manual: 12.2.9.3 Index Hint Syntax
  2. Mike Ault: Oracle SQL Hints Tuning
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. MSSQL 2017 Documentation

Script error: No such module "Check for unknown parameters".


Template:Asbox