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


|