Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9
Index hints
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Numerous syntaxes exist to make or prevent MySQL from using an index to access a table or for certain operations. Unlike the more generic Oracle-style hint comment syntax, these hints are embedded in the SQL statement directly:
SELECT * FROM BOOK USE INDEX i_book_a
create.selectFrom(BOOK.useIndex("i_book_a")) .fetch()
The following methods on org.jooq.Table
can be used for that purpose:
- Table.useIndex()
- Table.useIndexForJoin()
- Table.useIndexForOrderBy()
- Table.useIndexForGroupBy()
- Table.forceIndex()
- Table.forceIndexForJoin()
- Table.forceIndexForOrderBy()
- Table.forceIndexForGroupBy()
- Table.ignoreIndex()
- Table.ignoreIndexForJoin()
- Table.ignoreIndexForOrderBy()
- Table.ignoreIndexForGroupBy()
Feedback
Do you have any feedback about this page? We'd love to hear it!