mysql - Innodb 显示不正确的计数(id)

标签 mysql innodb

有一个约 3G 文件大小的 innodb 表(我使用 innodb_file_per_table = 1),刚刚从转储和 ~1.3G 转储文件中导入。不知道这里有多少记录。

当我执行“select count(id) from $table”时,我看到“27117291”(为了便于阅读,27,117,291)。 当我执行“select count(id) from $table limit 100”时,我还看到了“27117291”

为什么会这样? InnoDB 真的比 MyISAM 更好吗?!

附言如果我执行“select count(id) from $table where id=73010460;”我看到“1”。

最佳答案

select count(id) from $table

返回包含计数的一行。所以您的限制没有任何区别。

( Reference )

+-----------+
| COUNT(id) |
+-----------+
|  <count>  |
+-----------+

关于mysql - Innodb 显示不正确的计数(id),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13214496/

相关文章:

mysql - 带有 MySQL 的 AWS EC2 未使用任何可用资源(Big INSERT..SELECT)

php - 数据表连接表搜索和顺序卡在 codeigniter 上

mysql - char vs varchar 在股票数据库中的性能

php - 使用IP地址连接mysql

mysql - 为什么删除许多 BLOB 会锁定状态为 : enforcing dict cache limit? 的 MySQL 数据库

MySQL:获取引用已删除行的表列表

php - 如何在 mysql 或 php 中将动态数据行显示到数据列?

mysql。使用 IF 选择 field=1 或 field=2

php - 通过 PHP 检测 MySQL InnoDB

mysql - 在 InnoDB 中定义关系时的 CASCADE