<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"

        Getting Doctrine to use MySQL quot;FORCE INDEXquot;(让 Doctrine 使用 MySQL “FORCE INDEX)
          <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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Converting between timezones in PHP(在 PHP 中的时区之间转换)
                  PHP - strtotime, specify timezone(PHP - strtotime,指定时区)
                  Get current date, given a timezone in PHP?(获取当前日期,给定 PHP 中的时区?)
                  List of US Time Zones for PHP to use?(PHP 使用的美国时区列表?)
                  How to detect Ambiguous and Invalid DateTime in PHP?(如何在 PHP 中检测不明确和无效的 DateTime?)
                  How to update timezonedb in PHP (updating timezones info)?(如何在 PHP 中更新 timezonedb(更新时区信息)?)
                • <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>

                      • <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>
                            <tbody id='2rSEs'></tbody>

                          <small id='2rSEs'></small><noframes id='2rSEs'>