method
optimizer_hints
v7.1.3.2 -
Show latest stable
- Class:
ActiveRecord::QueryMethods
optimizer_hints(*args)public
Specify optimizer hints to be used in the SELECT statement.
Example (for MySQL):
Topic.optimizer_hints("MAX_EXECUTION_TIME(50000)", "NO_INDEX_MERGE(topics)") # SELECT /*+ MAX_EXECUTION_TIME(50000) NO_INDEX_MERGE(topics) */ `topics`.* FROM `topics`
Example (for PostgreSQL with pg_hint_plan):
Topic.optimizer_hints("SeqScan(topics)", "Parallel(topics 8)") # SELECT /*+ SeqScan(topics) Parallel(topics 8) */ "topics".* FROM "topics"