我有一个表,根据phpmyadmin的行数约为76.000行(显示行0 - 99(总共~76,853,查询占用0.0322秒)和) . 但是当尝试在4950条目之后从phpmyadmin浏览时,我得到空结果(没有显示) .
phpmyadmin中的相关查询是:
SELECT * FROM mytable LIMIT 5000 , 100
如果我从php脚本运行它,此查询也返回零行 .
我也从PHP脚本运行它
$getcache_PRST = $LGCACHEPDO->prepare("SELECT * FROM mytable");
$getcache_PRST->execute() or die($LGCACHEPDO->errorInfo());
$getcache_ROWN = $getcache_PRST->rowCount();
echo $getcache_ROWN ."<br>";
结果是4950行 .
我做的事情非常糟糕吗?
引擎是innoDB .
edit
$nRows = (int) $LGCACHEPDO->query("select count(*) from mytable")->fetchColumn();
echo $nRows;
和
$q = $LGCACHEPDO->query("select * from mytable");
$rows = $q->fetchAll();
$rowCount = count($rows);
echo "There are $rowCount rows\n";
这些查询也返回4950行...而不是76.000
2 回答
这是InnoDB表的常见问题解答 . 请参阅https://phpmyadmin.readthedocs.org/en/latest/faq.html?highlight=MaxExactCount#the-number-of-rows-for-innodb-tables-is-not-correct的说明
我下载了这张 table ,确实正如你们提到的那样,phpmyadmin的报告并不准确 . 行数确实是4950行 . 谢谢 .