为什么 mysql 的结果信息中总是有一个波浪符号 (~)

为什么 mysql 的结果信息中总是有一个波浪符号 (~)

每当我刷新或搜索 mysql 表中的任何内容时,结果消息总是显示这样的结果。

Showing rows 0 - 10 ( ~11 total , Query took 0.0004 sec)

当它显示准确的行数时,为什么总值前总是显示“~”符号。

这个符号表示这个表有“接近 11 行”或“大约 11 行”,但事实并非如此。它正好有 11 行。那么为什么是这个符号呢?

仅当我们没有结果或任何东西的确切值时,我们才会使用此符号。

我读了关于此问题的常见问题解答。

phpMyAdmin uses a quick method to get the row count, and this method only returns an approximate count in the case of InnoDB tables. See $cfg['MaxExactCount'] for a way to modify those results, but this could have a serious impact on performance.

此语句中使用的方法显示了以下几行

For InnoDB tables, determines for how large tables phpMyAdmin should get the exact row count using SELECT COUNT. If the approximate row count as returned by SHOW TABLE STATUS is smaller than this value, SELECT COUNT will be used, otherwise the approximate count will be used. 

我不明白这些话到底想表达什么。

答案1

您自己已经回答了这个问题,但让我详细说明一下。因为 phpMyAdmin 总是使用相同的快速方法来计算行数,所以它不是总是精确。数据越大,不准确的可能性就越大。phpMyAdmin 不会检查计数是否准确(这会违背快速计数的目的),因此它不知道什么时候是精确的。更简单(也更安全)的做法是谨慎行事,假设它可能不准确。

相关内容