<tfoot id='uJaLQ'></tfoot>

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

    • <bdo id='uJaLQ'></bdo><ul id='uJaLQ'></ul>

  • <i id='uJaLQ'><tr id='uJaLQ'><dt id='uJaLQ'><q id='uJaLQ'><span id='uJaLQ'><b id='uJaLQ'><form id='uJaLQ'><ins id='uJaLQ'></ins><ul id='uJaLQ'></ul><sub id='uJaLQ'></sub></form><legend id='uJaLQ'></legend><bdo id='uJaLQ'><pre id='uJaLQ'><center id='uJaLQ'></center></pre></bdo></b><th id='uJaLQ'></th></span></q></dt></tr></i><div id='uJaLQ'><tfoot id='uJaLQ'></tfoot><dl id='uJaLQ'><fieldset id='uJaLQ'></fieldset></dl></div>

      1. <legend id='uJaLQ'><style id='uJaLQ'><dir id='uJaLQ'><q id='uJaLQ'></q></dir></style></legend>
      2. MySQL 视图和索引使用

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

          • <tfoot id='jGTsM'></tfoot>

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

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

                  问题描述

                  我正在考虑开始利用视图来降低我们项目中代码和查询的复杂性——其中一些有一些连接,据我所知,MySQL 视图可以让我们更容易地引用这些数据在多个地方.

                  I was thinking of starting to utilize views to reduce the complexity of code and queries in our project -- some of them have a few joins, and from what I understand, MySQL views would allow us to reference that data a little easier in multiple places.

                  有很多东西被抛出,其中MySQL 不为视图使用索引"、你不能有索引视图"、只有你使用 MERGE"......没有明确的-截断答案.

                  There's a lot of stuff being thrown around, where "MySQL doesn't use indexes for views", "You can't have an indexed view", "Only if you use MERGE"... There is no clear-cut answer.

                  所以,切入正题:MySQL 视图是否使用索引在它们构建的表上?使用视图是一个坏主意,因为性能会很糟糕,还是在进行连接时会使用基础表上的索引?如果我按在表中编入索引的列对视图进行排序,它的排序速度是否仍像往常一样快?

                  So, to cut to the chase: Do MySQL views use indexes on the tables they are built from? Is it a bad idea to use views at all because performance will be abysmal, or will it use the indexes on the underlying tables when doing its joins? If I sort a view by a column that is indexed in the table, does it still sort as fast as it normally would?

                  我的研究似乎表明视图不使用索引,但如果是这样的话,没有人会使用它们;显然人们这样做,所以......?

                  Doing my research seems to indicate that views don't use indexes, but if that was the case nobody would ever use them; obviously people do, so...?

                  对不起,如果这看起来有点荒谬.

                  Sorry if this seems kind of absurd.

                  推荐答案

                  如果你查询一个视图,MySQL 考虑在底层表上使用索引.

                  If you query a view, MySQL will consider using indexes on the underlying tables.

                  但是,不能向视图中的计算列添加新索引.我认为这就是 MySQL 没有索引视图的意思,而不是(例如)SQL Server 的索引视图.

                  However it is not possible to add a new index to a calculated column in the view. I think this is what people meant by MySQL not having indexed views, as opposed to (for example) SQL Server's indexed views.

                  这篇关于MySQL 视图和索引使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:mySQL 中的交叉表视图? 下一篇:戴安娜是谁,为什么她不让我的数据库对象编译?

                  相关文章

                    <bdo id='5dzxS'></bdo><ul id='5dzxS'></ul>

                  <small id='5dzxS'></small><noframes id='5dzxS'>

                      <tfoot id='5dzxS'></tfoot>
                      <i id='5dzxS'><tr id='5dzxS'><dt id='5dzxS'><q id='5dzxS'><span id='5dzxS'><b id='5dzxS'><form id='5dzxS'><ins id='5dzxS'></ins><ul id='5dzxS'></ul><sub id='5dzxS'></sub></form><legend id='5dzxS'></legend><bdo id='5dzxS'><pre id='5dzxS'><center id='5dzxS'></center></pre></bdo></b><th id='5dzxS'></th></span></q></dt></tr></i><div id='5dzxS'><tfoot id='5dzxS'></tfoot><dl id='5dzxS'><fieldset id='5dzxS'></fieldset></dl></div>

                      <legend id='5dzxS'><style id='5dzxS'><dir id='5dzxS'><q id='5dzxS'></q></dir></style></legend>