mirror of
https://github.com/vrana/adminer.git
synced 2025-08-12 01:24:17 +02:00
Fast number of rows with big tables in PostgreSQL (thanks to juzna)
This commit is contained in:
@@ -490,6 +490,10 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table)
|
||||
return $return;
|
||||
}
|
||||
|
||||
function found_rows($table_status, $where) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function foreign_keys($table) {
|
||||
$return = array();
|
||||
foreach (get_rows("EXEC sp_fkeys @fktable_name = " . q($table)) as $row) {
|
||||
|
@@ -822,6 +822,15 @@ if (!defined("DRIVER")) {
|
||||
return $connection->query("EXPLAIN $query");
|
||||
}
|
||||
|
||||
/** Get approximate number of rows
|
||||
* @param array
|
||||
* @param array
|
||||
* @return int or null if approximate number can't be retrieved
|
||||
*/
|
||||
function found_rows($table_status, $where) {
|
||||
return ($where || $table_status["Engine"] != "InnoDB" ? null : $table_status["Rows"]);
|
||||
}
|
||||
|
||||
/** Get user defined types
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -275,6 +275,10 @@ ORDER BY uc.constraint_type, uic.column_position", $connection2) as $row) {
|
||||
return $connection->query("SELECT * FROM plan_table");
|
||||
}
|
||||
|
||||
function found_rows($table_status, $where) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
|
||||
$alter = $drop = array();
|
||||
foreach ($fields as $field) {
|
||||
|
@@ -511,6 +511,18 @@ ORDER BY p.proname');
|
||||
return $connection->query("EXPLAIN $query");
|
||||
}
|
||||
|
||||
function found_rows($table_status, $where) {
|
||||
global $connection;
|
||||
if (ereg(
|
||||
" rows=([0-9]+)",
|
||||
$connection->result("EXPLAIN SELECT * FROM " . idf_escape($table_status["Name"]) . ($where ? " WHERE " . implode(" AND ", $where) : "")),
|
||||
$regs
|
||||
)) {
|
||||
return $regs[1];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function types() {
|
||||
return get_vals("SELECT typname
|
||||
FROM pg_type
|
||||
|
@@ -503,6 +503,10 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
||||
return $connection->query("EXPLAIN $query");
|
||||
}
|
||||
|
||||
function found_rows($table_status, $where) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function types() {
|
||||
return array();
|
||||
}
|
||||
|
Reference in New Issue
Block a user