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 5 of 11 Topic 4542 of 4873
Post > Topic >>

Re: Statistics tab, "Tables" node

by guillaume@[EMAIL PROTECTED] (Guillaume Lelarge) May 6, 2008 at 03:49 PM

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

Dave Page a écrit :
> On Mon, May 5, 2008 at 4:38 PM, Guillaume Lelarge
> <guillaume@[EMAIL PROTECTED]
> wrote:
>>> +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.
> 
> It looks good to me, except the individual table stats should also
> show the new data (ie. when you click on a single table).  BTW, HOT
> update count is cool - didn't know we added that :-)
> 

Done. See attached patch.

> The display is getting a little wide - I think it's OK for now, but if
> anything else gets added we need to think about better ways to present
> the data I think.
> 

I completely agree.

> What might be a nice enhancement, is some auto-sizing based on column
> heading width. Wanna take a peek at that as well?
> 

I'll get a look at it tonight. Can I apply this patch first and then 
work on the "auto-sizing columns" patch ?


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

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

Index: pgadmin/schema/pgTable.cpp
===================================================================
--- pgadmin/schema/pgTable.cpp	(révision 7278)
+++ 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++;
         }
@[EMAIL PROTECTED]
 -816,9 +848,18 @[EMAIL PROTECTED]
              wxT(", idx_scan AS ") + qtIdent(_("Index Scans")) +
              wxT(", idx_tup_fetch AS ") + qtIdent(_("Index Tuples
Fetched"))+
              wxT(", n_tup_ins AS ") + qtIdent(_("Tuples Inserted"))+
-             wxT(", n_tup_upd AS ") + qtIdent(_("Tuples Updated")) +
-             wxT(", n_tup_del AS ") + qtIdent(_("Tuples Deleted")) +
-             wxT(", heap_blks_read AS ") + qtIdent(_("Heap Blocks Read"))
+
+             wxT(", n_tup_upd AS ") + qtIdent(_("Tuples Updated"))+
+             wxT(", n_tup_del AS ") + qtIdent(_("Tuples Deleted"));
+             
+    if (GetConnection()->BackendMinimumVersion(8, 3))
+    {
+        sql +=
+             wxT(", n_tup_hot_upd AS ") + qtIdent(_("Tuples HOT
Updated"))+
+             wxT(", n_live_tup AS ") + qtIdent(_("Live Tuples"))+
+             wxT(", n_dead_tup AS ") + qtIdent(_("Dead Tuples"));
+    }
+    
+    sql +=   wxT(", heap_blks_read AS ") + qtIdent(_("Heap Blocks Read"))
+
              wxT(", heap_blks_hit AS ") + qtIdent(_("Heap Blocks Hit")) +
              wxT(", idx_blks_read AS ") + qtIdent(_("Index Blocks Read"))
+
              wxT(", idx_blks_hit AS ") + qtIdent(_("Index Blocks Hit")) +

--------------040805020603080600070002
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

--------------040805020603080600070002--
 




 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:29:58 CST 2008.