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
Index (: indexes or indices) may refer to:
Arts, entertainment, and media Fictional entities
* Index (''A Certain Magical Index''), a character in the light novel series ''A Certain Magical Index''
* The Index, an item on the Halo Array in the ...
(even if the
query optimizer would decide otherwise).
Implementation
Different database engines use different approaches in implementing hints.
*
MySQL
MySQL () is an Open-source software, open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A rel ...
uses its own extension to the SQL standard, where a
table name may be followed by , or keywords.
*
Oracle
An oracle is a person or thing considered to provide insight, wise counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. If done through occultic means, it is a form of divination.
Descript ...
implements hints by using specially-crafted
comments in the query that begin with a symbol, thus not affecting SQL compatibility.
* EDB Postgres Advanced Server (a proprietary version of
PostgreSQL
PostgreSQL ( ) also known as Postgres, is a free and open-source software, free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. PostgreSQL features transaction processing, transactions ...
from
EnterpriseDB) offers hints compatible with those of Oracle.
*
Microsoft SQL Server
Microsoft SQL Server is a proprietary relational database management system developed by Microsoft using Structured Query Language (SQL, often pronounced "sequel"). As a database server, it is a software product with the primary function of ...
offers hints via the keyword
MSSQL 2017 Documentation
/ref>
See also
* Query optimizer
* Query plan
References
SQL
{{database-stub