mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-21 06:45:27 -06:00
Add CFS defragmentation for table or index.
В frmMaintenance добавлено выполнение принудительной дефрагментации сжатой таблицы или индекса. При выборе сжатой таблицы, автоматически дефрагментируются её сжатые индексы если их деврагметация более 1%.
This commit is contained in:
parent
bb831e57f2
commit
b1da480ca8
3 changed files with 33 additions and 1 deletions
|
|
@ -64,13 +64,23 @@ frmMaintenance::frmMaintenance(frmMain *form, pgObject *obj) : ExecutionDialog(f
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
txtMessages->SetMaxLength(0L);
|
txtMessages->SetMaxLength(0L);
|
||||||
#endif
|
#endif
|
||||||
|
bool iscomprss = false;
|
||||||
if (object->GetMetaType() == PGM_INDEX || object->GetMetaType() == PGM_PRIMARYKEY || object->GetMetaType() == PGM_UNIQUE)
|
if (object->GetMetaType() == PGM_INDEX || object->GetMetaType() == PGM_PRIMARYKEY || object->GetMetaType() == PGM_UNIQUE)
|
||||||
{
|
{
|
||||||
rbxAction->SetSelection(2);
|
rbxAction->SetSelection(2);
|
||||||
rbxAction->Enable(0, false);
|
rbxAction->Enable(0, false);
|
||||||
rbxAction->Enable(1, false);
|
rbxAction->Enable(1, false);
|
||||||
|
if (object->GetDatabase()->connection()->GetIsPgProEnt()) {
|
||||||
|
wxString ratio = object->GetConnection()->ExecuteScalar("select left((cfs_fragmentation("+object->GetOidStr()+")*100)::text,5)::text");
|
||||||
|
iscomprss = !(ratio == "NaN");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (object->GetMetaType() == PGM_TABLE) {
|
||||||
|
pgTable* t = (pgTable *)object;
|
||||||
|
iscomprss = !(t->GetRatio() == "");
|
||||||
|
|
||||||
|
}
|
||||||
|
rbxAction->Enable(4, iscomprss);
|
||||||
wxCommandEvent ev;
|
wxCommandEvent ev;
|
||||||
OnAction(ev);
|
OnAction(ev);
|
||||||
}
|
}
|
||||||
|
|
@ -218,6 +228,17 @@ wxString frmMaintenance::GetSql()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
sql = wxT("set cfs_gc_threshold = 0;select ");
|
||||||
|
sql += "cfs_gc_relation(" + object->GetOidStr() + ")";
|
||||||
|
if (object->GetMetaType() == PGM_TABLE) {
|
||||||
|
//sql += object->GetQuotedFullIdentifier();
|
||||||
|
wxString strindex= object->GetConnection()->ExecuteScalar("select string_agg('cfs_gc_relation('||indexrelid::text||')',',') from pg_index i where indrelid=" + object->GetOidStr() + " and cfs_fragmentation(indexrelid) between 0.01 and 1;");
|
||||||
|
if (strindex.Len() > 0) sql += ","+strindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sql;
|
return sql;
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,14 @@
|
||||||
<LocalDebuggerCommandArguments>-s mi -q</LocalDebuggerCommandArguments>
|
<LocalDebuggerCommandArguments>-s mi -q</LocalDebuggerCommandArguments>
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_(3.0)|x64'">
|
||||||
|
<LocalDebuggerCommandArguments>
|
||||||
|
</LocalDebuggerCommandArguments>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_(3.0)|x64'">
|
||||||
|
<LocalDebuggerCommandArguments>
|
||||||
|
</LocalDebuggerCommandArguments>
|
||||||
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
<item>ANALYZE</item>
|
<item>ANALYZE</item>
|
||||||
<item>REINDEX</item>
|
<item>REINDEX</item>
|
||||||
<item>CLUSTER</item>
|
<item>CLUSTER</item>
|
||||||
|
<item>COMPRESS</item>
|
||||||
</content>
|
</content>
|
||||||
<selection>0</selection>
|
<selection>0</selection>
|
||||||
<style>wxRA_SPECIFY_ROWS</style>
|
<style>wxRA_SPECIFY_ROWS</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue