On Wed, Jan 19, 2011 at 13:30, Dave Page <dp...@pgadmin.org> wrote:
> On Wed, Jan 19, 2011 at 12:29 PM, Magnus Hagander <mag...@hagander.net> wrote:
>> On Wed, Jan 19, 2011 at 13:22, Dave Page <dp...@pgadmin.org> wrote:
>>> On Wed, Jan 19, 2011 at 12:20 PM, Magnus Hagander <mag...@hagander.net> 
>>> wrote:
>>>> I came across yet another case of "i did vacuum full because it seemed
>>>> like a good idea" today.. Urgh.
>>>>
>>>> What do you guys think of a patch like the attached, which throws a
>>>> warning when you run vacuum full from the maintenance dialog on a
>>>> pre-9.0 version?
>>>
>>> Something like that should be a guru hint shouldn't it?
>>
>> Hmm. That might be an idea. I always turn those off because the
>> majority of them are just annoying ;)
>>
>> Where the heck is the *source* for the guru hints stored?
>
> docs/xxxx/hints.

Meh. So why didn't mym "git grep" find that.. *annoyance*.

Anyway. Something like this, then? Am I missing something still?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/
diff --git a/docs/en_US/hints/vacuum-full.html b/docs/en_US/hints/vacuum-full.html
new file mode 100644
index 0000000..60b35de
--- /dev/null
+++ b/docs/en_US/hints/vacuum-full.html
@@ -0,0 +1,33 @@
+<html>
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<link rel="STYLESHEET" type="text/css" href="../pgadmin3.css">
+<title>Guru Hints</title>
+</head>
+
+<body>
+
+<h3>VACUUM FULL</h3>
+<p>
+VACUUM FULL is not recommended on PostgreSQL versions prior to 9.0, except
+in extreme circumstances.
+</p>
+<p>
+VACUUM FULL should only be used if large amounts of data has been updated
+or deleted in a table, in order to release space back to the operating system,
+and only in cases where this space is not expected to be used by the table
+in the future. A regular VACUUM, without FULL, is usually enough in normal
+circumstances.
+</p>
+<p>
+VACUUM FULL will take out exclusive locks in the database, preventing
+<i>all</i> other activity on the table(s) being VACUUMed, and as such will
+have very large impact on other users of the database while it runs.
+</p>
+<p>
+After a table or database has been VACUUM FULL:ed, it is recommended to
+always REINDEX all indexes on the table as well.
+</p>
+</body>
+</html>
diff --git a/pgadmin/frm/frmHint.cpp b/pgadmin/frm/frmHint.cpp
index 27ca804..872712b 100644
--- a/pgadmin/frm/frmHint.cpp
+++ b/pgadmin/frm/frmHint.cpp
@@ -93,6 +93,13 @@ hintArray[] =
 		HINT_CANSUPPRESS | HINT_CANFIX
 	},
 	{
+		HINT_VACUUM_FULL,
+		__("Running VACUUM FULL not recommended"),
+		__("VACUUM FULL"),
+		wxT("pg/sql-vacuum"),
+		HINT_CANSUPPRESS | HINT_CANABORT
+	},
+	{
 		HINT_QUERYRUNTIME,
 		__("Query took a long time to complete"),
 		0,
diff --git a/pgadmin/frm/frmMaintenance.cpp b/pgadmin/frm/frmMaintenance.cpp
index 9a6585d..fa65548 100644
--- a/pgadmin/frm/frmMaintenance.cpp
+++ b/pgadmin/frm/frmMaintenance.cpp
@@ -18,6 +18,7 @@
 // App headers
 #include "pgAdmin3.h"
 #include "ctl/ctlMenuToolbar.h"
+#include "frm/frmHint.h"
 #include "frm/frmMaintenance.h"
 #include "frm/frmMain.h"
 #include "utils/sysLogger.h"
@@ -120,6 +121,13 @@ wxString frmMaintenance::GetSql()
 	{
 		case 0:
 		{
+			/* Warn about VACUUM FULL on < 9.0 */
+			if (chkFull->GetValue() &&
+				!conn->BackendMinimumVersion(9, 0))
+			{
+				if (frmHint::ShowHint(this, HINT_VACUUM_FULL) == wxID_CANCEL)
+					return wxEmptyString;
+			}
 			sql = wxT("VACUUM ");
 
 			if (chkFull->GetValue())
diff --git a/pgadmin/include/frm/frmHint.h b/pgadmin/include/frm/frmHint.h
index a5edf67..91f0ca6 100644
--- a/pgadmin/include/frm/frmHint.h
+++ b/pgadmin/include/frm/frmHint.h
@@ -19,6 +19,7 @@
 #define HINT_PRIMARYKEY         wxT("pk")
 #define HINT_FKINDEX            wxT("fki")
 #define HINT_VACUUM             wxT("vacuum")
+#define HINT_VACUUM_FULL        wxT("vacuum-full")
 #define HINT_QUERYRUNTIME       wxT("query-runtime")
 #define HINT_INSTRUMENTATION    wxT("instrumentation")
 #define HINT_ENCODING_ASCII     wxT("encoding-ascii")
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to