1. <tfoot id='7otkZ'></tfoot>

      <small id='7otkZ'></small><noframes id='7otkZ'>

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

        <bdo id='7otkZ'></bdo><ul id='7otkZ'></ul>

      1. <legend id='7otkZ'><style id='7otkZ'><dir id='7otkZ'><q id='7otkZ'></q></dir></style></legend>

        是否可以加速 MySQL 中的 sum()?

        Is it possible to speed up a sum() in MySQL?(是否可以加速 MySQL 中的 sum()?)

          <tfoot id='pAgEC'></tfoot>

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

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

                  <tbody id='pAgEC'></tbody>
                  <i id='pAgEC'><tr id='pAgEC'><dt id='pAgEC'><q id='pAgEC'><span id='pAgEC'><b id='pAgEC'><form id='pAgEC'><ins id='pAgEC'></ins><ul id='pAgEC'></ul><sub id='pAgEC'></sub></form><legend id='pAgEC'></legend><bdo id='pAgEC'><pre id='pAgEC'><center id='pAgEC'></center></pre></bdo></b><th id='pAgEC'></th></span></q></dt></tr></i><div id='pAgEC'><tfoot id='pAgEC'></tfoot><dl id='pAgEC'><fieldset id='pAgEC'></fieldset></dl></div>
                • 本文介绍了是否可以加速 MySQL 中的 sum()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在对 MySQL 数据库执行select sum(foo) from bar"查询,该查询汇总了 7.3 毫米的记录,每次运行大约需要 22 秒.在 MySQL 中是否有加速求和的技巧?

                  I'm doing a "select sum(foo) from bar" query on a MySQL database that's summing up 7.3mm records and taking about 22 seconds per run. Is there a trick to speeding up sums in MySQL?

                  推荐答案

                  不,你不能加速函数本身.这里的问题实际上是您要选择 730 万条记录.MySQL 必须扫描整个表,730 万是一个相当大的数字.实际上,它完成得如此之快给我留下了深刻的印象.

                  No, you can't speed up the function itself. The problem here is really that you're selecting 7.3 million records. MySQL has to scan the entire table, and 7.3 million is a pretty big number. I'm impressed that it finishes that fast, actually.

                  您可以采用的一种策略是将您的数据分解为更小的子集(可能按日期?月?)并为不会更改的旧数据维护一个总和.您可以定期更新总和,可以通过将总和以及此后添加的任何新数据(行数少得多)相加来计算总体值.

                  A strategy you could employ would be to break your data into smaller subsets (perhaps by date? Month?) and maintain a total sum for old data that's not going to change. You could periodically update the sum, and the overall value could be calculated by adding the sum, and any new data that's been added since then, which will be a much smaller number of rows.

                  这篇关于是否可以加速 MySQL 中的 sum()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
                  MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)
                  • <legend id='2aNtz'><style id='2aNtz'><dir id='2aNtz'><q id='2aNtz'></q></dir></style></legend>

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

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