为什么我的InnoDB表的记录计数值很奇怪? [英] Why does my InnoDB table have a weird value for record count?

查看:53
本文介绍了为什么我的InnoDB表的记录计数值很奇怪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的mysql数据库中2个表的行数
1是myisam,另一个是innodb,

有人可以告诉我为什么innodb的数字前面有这个吗?

这些数字来自phpmyadmin

10,308      MyISAM  
~118,011    InnoDB

解决方案

phpMyAdmin使用SHOW TABLE STATUS获取有关表的信息.

文档:

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

这是由于InnoDB是 ACID 兼容的存储引擎. InnoDB使用行级 MVCC /doc/refman/5.1/en/internal-locking.html"rel =" noreferrer>锁定.简而言之,在给定的时间可以有给定行的多个副本.我建议阅读这篇文章:了解InnoDB MVCC .

Below is the ammount of rows for 2 tables in my mysql DB
1 is myisam the other innodb,

can someone tell me why the innodb one has this ~ in front of the number?

These numbers came from phpmyadmin

10,308      MyISAM  
~118,011    InnoDB

解决方案

phpMyAdmin uses SHOW TABLE STATUS to get information for your tables.

From the documentation:

Rows

The number of rows. Some storage engines, such as MyISAM, store the exact 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.

This is due to InnoDB being an ACID compliant storage engine. InnoDB implements MVCC using row-level locking. In short, there can be multiple copies of a given row at a given time. I suggest reading this article: Understanding InnoDB MVCC.

这篇关于为什么我的InnoDB表的记录计数值很奇怪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆