Get a more accurate count of Tables rows in Debug using count instead of relying on show table status as this is not accurate all the time.

This commit is contained in:
johnnyq 2025-05-24 13:45:27 -04:00
parent 61de8bc792
commit f69de29353
1 changed files with 7 additions and 6 deletions

View File

@ -296,7 +296,13 @@ if ($tablesResult) {
while ($table = $tablesResult->fetch_assoc()) {
$tableName = $table['Name'];
$tableRows = $table['Rows'];
// Accurate row count
$countResult = $mysqli->query("SELECT COUNT(*) AS cnt FROM `$tableName`");
$countRow = $countResult->fetch_assoc();
$tableRows = $countRow['cnt'];
$countResult->free();
$dataLength = $table['Data_length'];
$indexLength = $table['Index_length'];
$tableSize = ($dataLength + $indexLength) / (1024 * 1024); // Size in MB
@ -336,11 +342,6 @@ if ($tablesResult) {
'name' => 'Total database size (MB)',
'value' => round($totalSize, 2) . ' MB',
];
} else {
$databaseStats[] = [
'name' => 'Database connection error',
'value' => $mysqli->error,
];
}
// Section: Database Structure Comparison