phpMyAdmin - 行列中的波浪号 (~) 是什么意思?

2022-01-05 00:00:00 php mysql phpmyadmin

我最近升级了 Joomla!使用大量文章数据集从 1.5 安装到 1.7 并且升级方法是升级数据库(基本上是将内容插入另一个表)我注意到 Rows 列值以波浪号(~):

I recently upgrade a Joomla! installation from 1.5 to 1.7 with a large dataset of articles and while the upgrade method was upgrading the database (inserting content to another table, basically) I noticed that the Rows column value was prefixed with a tilde (~):

现在,乍一看,我认为这意味着该值是近似值,因为当我刷新页面时,我看到了不同的值,有时更高,有时更低.好的,假设该值是近似值,在这种情况下,是什么原因造成的?一些注意事项:

Now, at first sight I assume this means that the value is approximate because when I refresh the page I see a different value, sometimes higher, sometimes lower. OK, lets say the value is approximate, in that case, what is causing that? Some considerations:

  • 操作系统:Windows 7.
  • 服务器:Apache 2,带有 PHP 5.3 和 MySQL 5.1.50-community.

推荐答案

行数是 InnoDB 用于查询优化的近似值.执行 count(*) 的效率要低得多,粗略了解行数足以优化查询计划.phpMyAdmin 将执行显示表状态"查询以获取有关表的信息:

The row count is an approximation used for query optimisation by InnoDB. doing a count(*) is a lot more inefficient and having a rough idea of the number of rows is sufficient to optimise the query plan. phpMyAdmin will be doing a "show table status" query to get the information about the table:

http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html

对于其他存储引擎,比如 InnoDB,这个值是一个近似值,可能与实际值相差 40 至50%.在这种情况下,请使用 SELECT COUNT(*) 获得准确的计数.

For other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%. In such cases, use SELECT COUNT(*) to obtain an accurate count.

相关文章