Mot-clé - pgAdmin 1.13

Fil des billets - Fil des commentaires

lundi, juillet 26 2010

Reset statistics for one table or one function

During 9.0 development, Magnus Hagander added two system functions to reset an object's statistics. The first one, pg_stat_reset_single_table_counters(), to reset a statistics of a specific relation, the second one, pg_stat_reset_single_function_counters(), to reset a function's statistics. I don't know why but it fell off my radar for some reason during the development of pgAdmin 1.11.

So, now that we can start adding new features to pgAdmin, I worked on a patch to use these two system functions.

Say you have a table named t1. It has some statistics. You can see them on the Statistics tab of the browser window:


You want to reset its statistics. Right-click on the table's name in the brower, select "Reset statistics":


pgAdmin will ask you to confirm the action:


And, if you answered yes, pgAdmin will fire the "SELECT pg_stat_reset_single_table_counters(<oid of the table>)" query, and display the new counters:


You probably noticed it didn't reset all counters. That's right. Index counters need to be reset separately. That's something missing on my patch. Something I should fix ASAP.