Add approximate row count for PostgreSQL driver
This commit is contained in:
parent
20e11be093
commit
0e31b09543
|
@ -205,7 +205,7 @@ if (isset($_GET["pgsql"])) {
|
|||
|
||||
function table_status($name = "") {
|
||||
$return = array();
|
||||
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids AS \"Oid\"
|
||||
foreach (get_rows("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN 'table' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_total_relation_size(oid) - pg_relation_size(oid) AS \"Index_length\", obj_description(oid, 'pg_class') AS \"Comment\", relhasoids AS \"Oid\", reltuples as \"Rows\"
|
||||
FROM pg_class
|
||||
WHERE relkind IN ('r','v')
|
||||
AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
|
||||
|
|
|
@ -13,7 +13,10 @@ if ($_GET["script"] == "db") {
|
|||
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
|
||||
if ($table_status[$key] != "") {
|
||||
$val = number_format($table_status[$key], 0, '.', lang(','));
|
||||
json_row("$key-$id", ($key == "Rows" && $table_status["Engine"] == "InnoDB" && $val ? "~ $val" : $val));
|
||||
json_row("$key-$id", ($key == "Rows" && $val && (
|
||||
$table_status["Engine"] == "InnoDB" || // MySQL InnoDB
|
||||
$table_status["Engine"] == "table" // PostgreSQL table reltype
|
||||
) ? "~ $val" : $val));
|
||||
if (isset($sums[$key])) {
|
||||
$sums[$key] += ($table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ Print current time next to executed SQL queries
|
|||
Highlight code in SQL command by CodeMirror
|
||||
Link to descending order
|
||||
Link to original table in EXPLAIN of SELECT * FROM table t
|
||||
PostgreSQL: approximate row count in table overview
|
||||
Oracle: schema, processlist, table overview numbers
|
||||
Replace JSMin by better JavaScript minifier
|
||||
Don't use AJAX links and forms
|
||||
|
|
Loading…
Reference in a new issue