Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Pgadmin Hackers > Re: Statistics ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 11 Topic 4542 of 4873
Post > Topic >>

Re: Statistics tab, "Tables" node

by guillaume@[EMAIL PROTECTED] (Guillaume Lelarge) May 5, 2008 at 05:38 PM

This is a multi-part message in MIME format.
--------------030004050403090402020700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Magnus Hagander a écrit :
> Guillaume Lelarge wrote:
>>  [...]
>> I'm wondering if we could put all pg_stat_all_tables columns here. 
>> That's a lot of informations, but at least some informations seem to
>> be worth it : n_live_tup, n_dead_tup, last_vacuum, last_autovacuum, 
>> last_analyze, last_autoanalyze. I would also like to add some other 
>> stuff like the % of the table in cache (if pg_buffercache is
>> available).
>>
>> Comments, ideas ?
> 
> +1 on the stuff from pg_stat (but make sure to check which columns are
> available in which version)
> 

The patch attached takes care of this.

> -1 on the pg_buffercache stuff. That one can be populated using a
> special option I think, but since pg_buffercache takes out some fairly
> heavy locking, we shouldn't do that by default.
> 

I agree, it would be better to have an option (disabled by default).


-- 
Guillaume.
  http://www.postgresqlfr.org
  http://dalibo.com

--------------030004050403090402020700
Content-Type: text/x-patch;
 name="tablesliststats.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="tablesliststats.patch"

Index: pgadmin/schema/pgTable.cpp
===================================================================
--- pgadmin/schema/pgTable.cpp	(révision 7274)
+++ pgadmin/schema/pgTable.cpp	(copie de travail)
@[EMAIL PROTECTED]
 -768,10 +768,27 @[EMAIL PROTECTED]
     statistics->AddColumn(_("Tuples inserted"), 50);
     statistics->AddColumn(_("Tuples updated"), 50);
     statistics->AddColumn(_("Tuples deleted"), 50);
+    if (GetConnection()->BackendMinimumVersion(8, 3))
+    {
+        statistics->AddColumn(_("Tuples HOT updated"), 50);
+        statistics->AddColumn(_("Live tuples"), 50);
+        statistics->AddColumn(_("Dead tuples"), 50);
+    }
+    if (GetConnection()->BackendMinimumVersion(8, 2))
+    {
+        statistics->AddColumn(_("Last vacuum"), 50);
+        statistics->AddColumn(_("Last autovacuum"), 50);
+        statistics->AddColumn(_("Last analyze"), 50);
+        statistics->AddColumn(_("Last autoanalyze"), 50);
+    }
     if (hasSize)
         statistics->AddColumn(_("Size"), 60);
 
     wxString sql=wxT("SELECT st.relname, n_tup_ins, n_tup_upd,
n_tup_del");
+    if (GetConnection()->BackendMinimumVersion(8, 3))
+        sql += wxT(", n_tup_hot_upd, n_live_tup, n_dead_tup");
+    if (GetConnection()->BackendMinimumVersion(8, 2))
+        sql += wxT(", last_vacuum, last_autovacuum, last_analyze,
last_autoanalyze");
     if (hasSize)
         sql += wxT(", pg_size_pretty(pg_relation_size(st.relid)")
                wxT(" + CASE WHEN cl.reltoastrelid = 0 THEN 0 ELSE
pg_relation_size(cl.reltoastrelid) + COALESCE((SELECT
SUM(pg_relation_size(indexrelid)) FROM pg_index WHERE
indrelid=cl.reltoastrelid)::int8, 0) END")
@[EMAIL PROTECTED]
 -781,20 +798,35 @[EMAIL PROTECTED]
            wxT("  JOIN pg_class cl on cl.oid=st.relid\n")
 	       wxT(" WHERE schemaname = ") + qtDbString(GetSchema()->GetName())
 	    +  wxT("\n ORDER BY relname");
-
+	    
     pgSet *stats = GetDatabase()->ExecuteSet(sql);
 
     if (stats)
     {
         long pos=0;
+        int i;
         while (!stats->Eof())
         {
+            i = 4;
             statistics->InsertItem(pos, stats->GetVal(wxT("relname")),
PGICON_STATISTICS);
             statistics->SetItem(pos, 1, stats->GetVal(wxT("n_tup_ins")));
             statistics->SetItem(pos, 2, stats->GetVal(wxT("n_tup_upd")));
             statistics->SetItem(pos, 3, stats->GetVal(wxT("n_tup_del")));
+            if (GetConnection()->BackendMinimumVersion(8, 3))
+            {
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("n_tup_hot_upd")));
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("n_live_tup")));
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("n_dead_tup")));
+            }
+            if (GetConnection()->BackendMinimumVersion(8, 2))
+            {
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("last_vacuum")));
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("last_autovacuum")));
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("last_analyze")));
+                statistics->SetItem(pos, i++,
stats->GetVal(wxT("last_autoanalyze")));
+            }
             if (hasSize)
-                statistics->SetItem(pos, 4, stats->GetVal(wxT("size")));
+                statistics->SetItem(pos, i, stats->GetVal(wxT("size")));
             stats->MoveNext();
             pos++;
         }

--------------030004050403090402020700
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

--------------030004050403090402020700--
 




 11 Posts in Topic:
Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-05 14:44:00 
Re: Statistics tab, "Tables" node
magnus@[EMAIL PROTECTED]   2008-05-05 14:53:44 
Re: Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-05 17:38:50 
Re: Statistics tab, "Tables" node
dpage@[EMAIL PROTECTED]   2008-05-06 14:12:36 
Re: Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-06 15:49:52 
Re: Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-12 11:19:26 
Re: Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-12 11:21:39 
Re: Statistics tab, "Tables" node
dpage@[EMAIL PROTECTED]   2008-05-06 15:07:43 
Re: Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-06 16:17:17 
Re: Statistics tab, "Tables" node
dpage@[EMAIL PROTECTED]   2008-05-12 10:34:03 
Re: Statistics tab, "Tables" node
guillaume@[EMAIL PROTECTE  2008-05-12 11:45:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 23:59:29 CST 2008.