mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-21 06:45:27 -06:00
Add reset index statistics.
Добавлена команда "Reset index statistics".
This commit is contained in:
parent
01e6966734
commit
1ae40f28af
3 changed files with 37 additions and 0 deletions
|
|
@ -315,6 +315,7 @@ void frmMain::CreateMenus()
|
||||||
new refreshConcurrentlyMatViewFactory(menuFactories, viewMenu, 0);
|
new refreshConcurrentlyMatViewFactory(menuFactories, viewMenu, 0);
|
||||||
new executePgstattupleFactory(menuFactories, viewMenu, 0);
|
new executePgstattupleFactory(menuFactories, viewMenu, 0);
|
||||||
new executePgstatindexFactory(menuFactories, viewMenu, 0);
|
new executePgstatindexFactory(menuFactories, viewMenu, 0);
|
||||||
|
new resetIndexStatsFactory(menuFactories, viewMenu, 0);
|
||||||
new executePgcheckindexFactory(menuFactories, viewMenu, 0);
|
new executePgcheckindexFactory(menuFactories, viewMenu, 0);
|
||||||
new enabledisableRuleFactory(menuFactories, toolsMenu, 0);
|
new enabledisableRuleFactory(menuFactories, toolsMenu, 0);
|
||||||
new enabledisableTriggerFactory(menuFactories, toolsMenu, 0);
|
new enabledisableTriggerFactory(menuFactories, toolsMenu, 0);
|
||||||
|
|
|
||||||
|
|
@ -354,5 +354,13 @@ public:
|
||||||
bool CheckEnable(pgObject* obj);
|
bool CheckEnable(pgObject* obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class resetIndexStatsFactory : public contextActionFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
resetIndexStatsFactory(menuFactoryList* list, wxMenu* mnu, ctlMenuToolbar* toolbar);
|
||||||
|
wxWindow* StartDialog(frmMain* form, pgObject* obj);
|
||||||
|
bool CheckEnable(pgObject* obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -547,6 +547,34 @@ bool executePgstatindexFactory::CheckChecked(pgObject *obj)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
resetIndexStatsFactory::resetIndexStatsFactory(menuFactoryList* list, wxMenu* mnu, ctlMenuToolbar* toolbar) : contextActionFactory(list)
|
||||||
|
{
|
||||||
|
mnu->Append(id, _("&Reset index statistics"), _("Reset statistics of the selected index."));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxWindow* resetIndexStatsFactory::StartDialog(frmMain* form, pgObject* obj)
|
||||||
|
{
|
||||||
|
if (wxMessageBox(_("Are you sure you wish to reset statistics of this index?"), _("Reset statistics"), wxYES_NO) != wxYES)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
wxString sql = wxT("SELECT pg_stat_reset_single_table_counters(")
|
||||||
|
+ NumToStr(obj->GetOid())
|
||||||
|
+ wxT(")");
|
||||||
|
obj->GetDatabase()->ExecuteVoid(sql);
|
||||||
|
|
||||||
|
((pgIndexBase*)obj)->ShowStatistics(form, form->GetStatistics());
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool resetIndexStatsFactory::CheckEnable(pgObject* obj)
|
||||||
|
{
|
||||||
|
return obj &&
|
||||||
|
(obj->IsCreatedBy(indexFactory) || obj->IsCreatedBy(primaryKeyFactory)
|
||||||
|
|| obj->IsCreatedBy(uniqueFactory) || obj->IsCreatedBy(excludeFactory));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pgIndex::pgIndex(pgSchema *newSchema, const wxString &newName)
|
pgIndex::pgIndex(pgSchema *newSchema, const wxString &newName)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue