Hint (SQL)

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 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]
  • 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 OPTION keyword [5]

See also

References

  1. ^ MySQL 5.5 Reference Manual: 12.2.9.3 Index Hint Syntax
  2. ^ Mike Ault: Oracle SQL Hints Tuning
  3. ^ "Postgres Plus Advanced Server Performance and Scalability Guide: Query Optimization Hints". Archived from the original on 2014-04-19. Retrieved 2013-06-24.
  4. ^ "Postgres Plus Advanced Server Oracle Compatibility Developer's Guide: Optimizer Hints". Archived from the original on 2014-04-19. Retrieved 2013-06-24.
  5. ^ MSSQL 2017 Documentation


Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.