Hint (SQL)
Encyclopedia
In database query operations, various SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

implementations use hints as additions to the SQL standard that instruct the database engine
Database engine
A database engine is the underlying software component that a database management system uses to create, read, update and delete data from a database....

 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
Index (database)
A database index is a data structure that improves the speed of data retrieval operations on a database table at the cost of slower writes and increased storage space...

 (even if the query optimizer
Query optimizer
The query optimizer is the component of a database management system that attempts to determine the most efficient way to execute a query. The optimizer considers the possible query plans for a given input query, and attempts to determine which of those plans will be the most efficient...

 would decide otherwise).

Implementation

Different database engines use different approaches in implementing hints.
  • MySQL
    MySQL
    MySQL officially, but also commonly "My Sequel") is a relational database management system that runs as a server providing multi-user access to a number of databases. It is named after developer Michael Widenius' daughter, My...

     uses its own extension to the SQL standard, where a table
    Table (database)
    In relational databases and flat file databases, a table is a set of data elements that is organized using a model of vertical columns and horizontal rows. A table has a specified number of columns, but can have any number of rows...

     name may be followed by USE INDEX, FORCE INDEX or IGNORE INDEX keywords.
  • Oracle
    Oracle Database
    The Oracle Database is an object-relational database management system produced and marketed by Oracle Corporation....

     implements hints by using specially-crafted comments in the query that begin with a + symbol, thus not affecting SQL compatibility.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK