如何做一个快速但innacurate InnoDB行计数? [英] How to do a fast but innacurate InnoDB row count?

查看:181
本文介绍了如何做一个快速但innacurate InnoDB行计数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHPMyAdmin的常见问题有这个说法关于InnoDB的大致行数:

The FAQ of PHPMyAdmin has this to say about its approximate row counts for InnoDB:


phpMyAdmin使用快速方法获取行计数,此方法仅返回InnoDB表的大致计数。

phpMyAdmin uses a quick method to get the row count, and this method only returns an approximate count in the case of InnoDB tables.

我想使用这个快速方法 - 但是我搜索的每个地方似乎都有不同的答案。

I would like to use this 'quick method' - but everywhere I search seems to have a different answer.

有人知道吗?

推荐答案

他们执行此操作

SHOW TABLE STATUS LIKE 'foo';




这会返回一个Rows列。使用
MyISAM它是100%准确,InnoDB只是
猜。这是为什么MyISAM在执行SELECT
COUNT(*)查询时没有
子句的情况下比InnoDB更快

This returns a 'Rows' column. With MyISAM it's 100% accurate, InnoDB just guesses. This is why MyISAM is faster than InnoDB when doing a 'SELECT COUNT(*)' query without a where clause.

phpMyAdmin是开源的,所以你可以自己去查看代码!

phpMyAdmin is open-source, so you can just go into the code and see for yourself!

这篇关于如何做一个快速但innacurate InnoDB行计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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