【问题标题】:How can I ignore a MySQL index using ActiveRecord?如何使用 ActiveRecord 忽略 MySQL 索引?
【发布时间】:2019-11-18 23:21:13
【问题描述】:

MySQL 具有忽略查询的语法。例如:

SELECT * FROM t1 IGNORE INDEX (i1);

如何使用 ActiveRecord 构建上述查询?

【问题讨论】:

    标签: mysql ruby-on-rails activerecord


    【解决方案1】:

    发现您可以像这样指定自定义from clause

    T1.from("t1 ignore index (i1)")
    

    半相关文档:https://apidock.com/rails/v4.0.2/ActiveRecord/QueryMethods/from

    【讨论】:

      猜你喜欢
      • 2010-10-31
      • 2010-12-02
      • 2017-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-15
      相关资源
      最近更新 更多