<bdo id='rkdfc'></bdo><ul id='rkdfc'></ul>
    1. <legend id='rkdfc'><style id='rkdfc'><dir id='rkdfc'><q id='rkdfc'></q></dir></style></legend>

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

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

        为什么行通过“解释"返回?不等于count()?

        时间:2023-05-23

          <tbody id='l0nUZ'></tbody>
              <i id='l0nUZ'><tr id='l0nUZ'><dt id='l0nUZ'><q id='l0nUZ'><span id='l0nUZ'><b id='l0nUZ'><form id='l0nUZ'><ins id='l0nUZ'></ins><ul id='l0nUZ'></ul><sub id='l0nUZ'></sub></form><legend id='l0nUZ'></legend><bdo id='l0nUZ'><pre id='l0nUZ'><center id='l0nUZ'></center></pre></bdo></b><th id='l0nUZ'></th></span></q></dt></tr></i><div id='l0nUZ'><tfoot id='l0nUZ'></tfoot><dl id='l0nUZ'><fieldset id='l0nUZ'></fieldset></dl></div>
            1. <tfoot id='l0nUZ'></tfoot><legend id='l0nUZ'><style id='l0nUZ'><dir id='l0nUZ'><q id='l0nUZ'></q></dir></style></legend>

                • <bdo id='l0nUZ'></bdo><ul id='l0nUZ'></ul>
                • <small id='l0nUZ'></small><noframes id='l0nUZ'>

                  本文介绍了为什么行通过“解释"返回?不等于count()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..
                      mysql> select count(*) from table where relation_title='xxxxxxxxx';
                  +----------+
                  | count(*) |
                  +----------+
                  |  1291958 |
                  +----------+
                  
                  mysql> explain select *  from table where relation_title='xxxxxxxxx';
                  +----+-------------+---------+-
                  | id | select_type | rows    |
                  +----+-------------+---------+-
                  |  1 | SIMPLE      | 1274785 | 
                  +----+-------------+---------+-
                  

                  我认为解释 select * from table where relationship_title='xxxxxxxxx';"按索引返回relation_title='xxxxxxxxx' 的行.但它比真正的数字小.

                  I think that "explain select * from table where relation_title='xxxxxxxxx';" returns the rows of relation_title='xxxxxxxxx' by index. But it's small than the true num.

                  推荐答案

                  它显示了它运行了多少行以获得您的结果.

                  It is showing how many rows it ran through to get your result.

                  错误数据的原因是 EXPLAIN 不准确,它根据存储的有关您的表的信息对您的数据进行猜测.

                  The reason for the wrong data is that EXPLAIN is not accurate, it makes guesses about your data based on information stored about your table.

                  这是非常有用的信息,例如在对许多表执行 JOINS 时,您希望确保不会为每一行的一行信息遍历整个连接表.

                  This is very useful information, for example when doing JOINS on many tables and you want to be sure that you aren't running through the entire joined table for one row of information for each row you have.

                  这是对 608 行表的测试.

                  Here's a test on a 608 row table.

                  SELECT COUNT(id) FROM table WHERE user_id = 1
                  

                  结果:

                  COUNT(id)
                  512
                  

                  这里是解释

                  EXPLAIN SELECT COUNT(id) FROM table WHERE user_id = 1
                  

                  结果:

                  id  rows
                  1   608
                  

                  这篇关于为什么行通过“解释"返回?不等于count()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:来自变量的mysql字段名称 下一篇:SELECT 查询从每组返回 1 行

                  相关文章

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

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

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