<tfoot id='osOzE'></tfoot>

    1. <small id='osOzE'></small><noframes id='osOzE'>

      <legend id='osOzE'><style id='osOzE'><dir id='osOzE'><q id='osOzE'></q></dir></style></legend>
      <i id='osOzE'><tr id='osOzE'><dt id='osOzE'><q id='osOzE'><span id='osOzE'><b id='osOzE'><form id='osOzE'><ins id='osOzE'></ins><ul id='osOzE'></ul><sub id='osOzE'></sub></form><legend id='osOzE'></legend><bdo id='osOzE'><pre id='osOzE'><center id='osOzE'></center></pre></bdo></b><th id='osOzE'></th></span></q></dt></tr></i><div id='osOzE'><tfoot id='osOzE'></tfoot><dl id='osOzE'><fieldset id='osOzE'></fieldset></dl></div>
      • <bdo id='osOzE'></bdo><ul id='osOzE'></ul>
      1. 让 Doctrine 使用 MySQL “FORCE INDEX"

        时间:2024-08-15
          <tbody id='GS35e'></tbody>
        <i id='GS35e'><tr id='GS35e'><dt id='GS35e'><q id='GS35e'><span id='GS35e'><b id='GS35e'><form id='GS35e'><ins id='GS35e'></ins><ul id='GS35e'></ul><sub id='GS35e'></sub></form><legend id='GS35e'></legend><bdo id='GS35e'><pre id='GS35e'><center id='GS35e'></center></pre></bdo></b><th id='GS35e'></th></span></q></dt></tr></i><div id='GS35e'><tfoot id='GS35e'></tfoot><dl id='GS35e'><fieldset id='GS35e'></fieldset></dl></div>
          <bdo id='GS35e'></bdo><ul id='GS35e'></ul>
        • <tfoot id='GS35e'></tfoot>

                <legend id='GS35e'><style id='GS35e'><dir id='GS35e'><q id='GS35e'></q></dir></style></legend>

                  <small id='GS35e'></small><noframes id='GS35e'>

                  本文介绍了让 Doctrine 使用 MySQL “FORCE INDEX"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 Doctrine 的 DQL 中有一个查询,需要能够使用 MySQL 的FORCE INDEX".功能,以大大减少查询时间.下面是查询在普通 SQL 中的基本样子:

                  I have a query in Doctrine's DQL that needs to be able to use MySQL's "FORCE INDEX" functionality in order to massively reduce the query time. Below is what the query basically looks like in plain SQL:

                  SELECT id FROM items FORCE INDEX (best_selling_idx)
                  WHERE price = ... (etc)
                  LIMIT 200;
                  

                  我假设我必须扩展一些 Doctrine 组件才能使用 DQL 执行此操作(或者有没有办法将任意 SQL 注入到 Doctrin 的查询之一中?).有人有什么想法吗?

                  I assume I have to extend some Doctrine component to be able to do this with DQL (or is there a way to inject arbitrary SQL into one of Doctrin's queries?). Anyone have any ideas?

                  推荐答案

                  我在网上找到了很少有帮助的 Doctrine_RawSql 示例,所以这就是我最终创建查询的方法.

                  I've found very few helpful Doctrine_RawSql examples online, so here's what I ended up doing to create my query.

                  $q = new Doctrine_RawSql();
                  $q->select('{b.id}, {b.description}, {c.description}')
                    ->from('table1 b FORCE INDEX(best_selling_idx) INNER JOIN table2 c ON b.c_id = c.id')
                    ->addComponent('b', 'Table1 b')
                    ->addComponent('c', 'b.Table2 c');
                  

                  这篇关于让 Doctrine 使用 MySQL “FORCE INDEX"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 Doctrine (Symfony2) 查询表时缺少行 下一篇:Doctrine_RawSql 查询中的聚合值

                  相关文章

                • <legend id='2rSEs'><style id='2rSEs'><dir id='2rSEs'><q id='2rSEs'></q></dir></style></legend>
                    <bdo id='2rSEs'></bdo><ul id='2rSEs'></ul>
                  <tfoot id='2rSEs'></tfoot>

                  1. <i id='2rSEs'><tr id='2rSEs'><dt id='2rSEs'><q id='2rSEs'><span id='2rSEs'><b id='2rSEs'><form id='2rSEs'><ins id='2rSEs'></ins><ul id='2rSEs'></ul><sub id='2rSEs'></sub></form><legend id='2rSEs'></legend><bdo id='2rSEs'><pre id='2rSEs'><center id='2rSEs'></center></pre></bdo></b><th id='2rSEs'></th></span></q></dt></tr></i><div id='2rSEs'><tfoot id='2rSEs'></tfoot><dl id='2rSEs'><fieldset id='2rSEs'></fieldset></dl></div>
                  2. <small id='2rSEs'></small><noframes id='2rSEs'>