]> git.joonet.de Git - adminer.git/commitdiff
Find exact count on big page only with InnoDB
authorJakub Vrana <jakub@vrana.cz>
Fri, 11 Mar 2011 20:59:32 +0000 (21:59 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 11 Mar 2011 20:59:58 +0000 (21:59 +0100)
adminer/select.inc.php

index d490cd7a7dd19155526c5a7504c5f78eb96c5254..00ee9e77c09e44baf5374e6d1f38d35c9fbb03ee 100644 (file)
@@ -369,9 +369,9 @@ if (!$columns) {
                        $exact_count = true;
                        if ($_GET["page"] != "last" && +$limit && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
                                $found_rows = $table_status["Rows"];
-                               if (!isset($found_rows) || $where || 2 * $page * $limit > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e4)) {
+                               if (!isset($found_rows) || $where || ($table_status["Engine"] == "InnoDB" && $found_rows < max(1e4, 2 * ($page + 1) * $limit))) {
                                        // slow with big tables
-                                       ob_flush();
+                                       ob_flush(); //! doesn't work with AJAX
                                        flush();
                                        $found_rows = $connection->result("SELECT COUNT(*) FROM " . table($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
                                } else {