SELECT COUNT(*) is slow in InnoDB

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@547 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-01-13 15:22:36 +00:00
parent f22e16c919
commit 897b80ae17
10 changed files with 13 additions and 4 deletions

View file

@ -185,10 +185,10 @@ if (isset($_GET["download"])) {
echo '<thead><tr><td><input type="checkbox" onclick="var elems = this.form.elements; for (var i=0; elems.length > i; i++) if (elems[i].name == \'tables[]\') elems[i].checked = this.checked;" /></td><th>' . lang('Table') . '</th><td>' . lang('Engine') . '</td><td>' . lang('Comment') . '</td><td>' . lang('Collation') . '</td><td>' . lang('Data Length') . '</td><td>' . lang('Index Length') . '</td><td>' . lang('Data Free') . '</td><td>' . lang('Auto Increment') . '</td><td>' . lang('Rows') . "</td></tr></thead>\n";
while ($row = $result->fetch_assoc()) {
table_comment($row);
echo '<tr class="nowrap"><td>' . (isset($row["Rows"]) ? '<input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '"' . (in_array($row["Name"], (array) $_POST["tables"], true) ? ' checked="checked"' : '') . ' /></td><th><a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th><td>$row[Engine]</td><td>" . htmlspecialchars($row["Comment"]) . "</td><td>$row[Collation]" : '&nbsp;</td><th><a href="' . htmlspecialchars($SELF) . 'view=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . '</a></th><td colspan="7">' . lang('View'));
$row["count"] = $mysql->result($mysql->query("SELECT COUNT(*) FROM " . idf_escape($row["Name"])));
foreach ((isset($row["Rows"]) ? array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create") : array()) + array("count" => "select") as $key => $link) {
echo '</td><td align="right">' . (strlen($row[$key]) ? '<a href="' . htmlspecialchars("$SELF$link=") . urlencode($row["Name"]) . '">' . number_format($row[$key], 0, '.', lang(',')) . '</a>' : '&nbsp;');
echo '<tr class="nowrap"><td>' . (isset($row["Rows"]) ? '<input type="checkbox" name="tables[]" value="' . htmlspecialchars($row["Name"]) . '"' . (in_array($row["Name"], (array) $_POST["tables"], true) ? ' checked="checked"' : '') . ' /></td><th><a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . "</a></th><td>$row[Engine]</td><td>" . htmlspecialchars($row["Comment"]) . "</td><td>$row[Collation]" : '&nbsp;</td><th><a href="' . htmlspecialchars($SELF) . 'view=' . urlencode($row["Name"]) . '">' . htmlspecialchars($row["Name"]) . '</a></th><td colspan="8"><a href="' . htmlspecialchars($SELF) . "select=" . urlencode($row["Name"]) . '">' . lang('View') . '</a>');
foreach ((isset($row["Rows"]) ? array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "create", "Rows" => "select") : array()) as $key => $link) {
$val = number_format($row[$key], 0, '.', lang(','));
echo '</td><td align="right">' . (strlen($row[$key]) ? '<a href="' . htmlspecialchars("$SELF$link=") . urlencode($row["Name"]) . '">' . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('around %s', $val) : $val) . '</a>' : '&nbsp;');
}
echo "</td></tr>\n";
}

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => 'Událost',
'MySQL version: %s through PHP extension %s' => 'Verze MySQL: %s přes PHP extenzi %s',
'%d row(s)' => array('%d řádek', '%d řádky', '%d řádků'),
'around %s' => 'přibližně %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'Při změně aktuální čas',
'Remove' => 'Odebrat',
'Are you sure?' => 'Opravdu?',

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => 'Ereignis',
'MySQL version: %s through PHP extension %s' => 'Version MySQL: %s, mit PHP-Erweiterung %s',
'%d row(s)' => array('%d Datensatz', '%d Datensätze'),
'around %s' => 'ungefähren %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => 'Entfernen',
'Are you sure?' => 'Sind Sie sicher ?',

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => 'Evento',
'MySQL version: %s through PHP extension %s' => 'Versión MySQL: %s a través de extensión PHP %s',
'%d row(s)' => array('%d fila', '%d filas'),
'around %s' => 'acaso %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => 'Eliminar',
'Are you sure?' => 'Está seguro?',

View file

@ -135,6 +135,7 @@ $translations = array(
'Time' => 'Aeg',
'Event' => 'Sündmus',
'%d row(s)' => array('%d rida', '%d rida'),
'around %s' => 'umbes %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => 'Eemalda',
'Are you sure?' => 'Kas oled kindel?',

View file

@ -135,6 +135,7 @@ $translations = array(
'Time' => 'Temps',
'Event' => 'Évènement',
'%d row(s)' => array('%d ligne', '%d lignes'),
'around %s' => 'autour %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => 'Effacer',
'Are you sure?' => 'Êtes-vous certain?',

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => 'Evento',
'MySQL version: %s through PHP extension %s' => 'Versione MySQL: %s via estensione PHP %s',
'%d row(s)' => array('%d riga', '%d righe'),
'around %s' => 'su %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => 'Rimuovi',
'Are you sure?' => 'Sicuro?',

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => 'Event',
'MySQL version: %s through PHP extension %s' => 'MySQL versie: %s met PHP extensie %s',
'%d row(s)' => array('%d rij', '%d rijen'),
'around %s' => 'ongeveer %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => 'Verwijderen',
'Are you sure?' => 'Weet u het zeker?',

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => 'Udalosť',
'MySQL version: %s through PHP extension %s' => 'Verzia MySQL: %s cez PHP rozšírenie %s',
'%d row(s)' => array('%d riadok', '%d riadky', '%d riadkov'),
'around %s' => 'približne %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'Pri zmene aktuálny čas',
'Remove' => 'Odobrať',
'Are you sure?' => 'Naozaj?',

View file

@ -136,6 +136,7 @@ $translations = array(
'Event' => '事件',
'MySQL version: %s through PHP extension %s' => 'MySQL 版本: %s 通过 PHP 扩展 %s',
'%d row(s)' => '%d 行',
'around %s' => '附近的 %s',
'ON UPDATE CURRENT_TIMESTAMP' => 'ON UPDATE CURRENT_TIMESTAMP',
'Remove' => '移除',
'Are you sure?' => '你确定吗?',