Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.

Поиск
Список
Период
Сортировка
От Ron Mayer
Тема Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.
Дата
Msg-id Pine.LNX.4.58.0502241458470.13185@greenie.cheapcomplexdevices.com
обсуждение исходный текст
Ответ на Re: [PATCHES] A way to let Vacuum warn if FSM settings are low.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Thu, 24 Feb 2005, Tom Lane wrote:
> I'd go for making them both LOG, I think.  More consistent.

Ok, here's another try :)  With a couple more questions...

  1. If I read Simon's email correctly, it implied that he wanted to see
     the "free space map" message for a VACUUM even when VERBOSE is turned off.
     I could just tweak it in PrintFreeSpaceMapStastics() as shown here...
     but now elevel (which depended on VACUUM VERBOSE or not) is no longer
     needed by PrintFreeSpaceMapStastics.
     1a. Is that desired to always show this line as an INFO instead of
         a DEBUG2 (which it currently is when VERBOSE is not selected)?
     1b. Should I tweak vacuum.c (feels cleaner) or just freespace.c (minimal
         changes).

  2. If I read Simon's email correctly, it implied that he wanted to see
     these new lines when you type VACUUM.  This would suggest making
     them INFOs. Making them INFOs would slightly contradict another
     goal of wanting to see them in the LOG for automated log
     grepping scripts to find, since that would require turning on INFOs
     that I think commonly aren't logged.   Also making them LOGs is
     consistent with the checkpoint hint.   I suppose they could be
     made NOTICEs; but that isn't consistent with either.



diff -u postgresql-8.0.1/src/backend/storage/freespace/freespace.c
postgresql-patched/src/backend/storage/freespace/freespace.c
--- postgresql-8.0.1/src/backend/storage/freespace/freespace.c    2004-12-31 14:00:54.000000000 -0800
+++ postgresql-patched/src/backend/storage/freespace/freespace.c    2005-02-24 14:54:36.619566040 -0800
@@ -705,12 +705,25 @@
     /* Convert stats to actual number of page slots needed */
     needed = (sumRequests + numRels) * CHUNKPAGES;

-    ereport(elevel,
+    ereport(INFO,
             (errmsg("free space map: %d relations, %d pages stored; %.0f total pages needed",
                     numRels, storedPages, needed),
              errdetail("Allocated FSM size: %d relations + %d pages = %.0f kB shared memory.",
                        MaxFSMRelations, MaxFSMPages,
                        (double) FreeSpaceShmemSize() / 1024.0)));
+
+    if (numRels == MaxFSMRelations)
+        ereport(LOG,
+            (errmsg("max_fsm_relations(%d) is equal than the number of relations vacuum checked (%d)",
+             MaxFSMRelations, numRels),
+             errhint("You probably have more than %d relations. You should increase max_fsm_relations. Pages needed
formax_fsm_pages may have been underestimated. ",numRels))); 
+    else
+    if (needed > MaxFSMPages)
+        ereport(LOG,
+            (errmsg("max_fsm_pages(%d) is smaller than the actual number of page slots needed(%.0f)",
+             MaxFSMPages, needed),
+             errhint("You may want to increase max_fsm_pages to be larger than %.0f",needed)));
+
 }


В списке pgsql-general по дате отправления:

Предыдущее
От: Rick Casey
Дата:
Сообщение: Re: basic trigger using OLD not working?
Следующее
От: Postgres Coder
Дата:
Сообщение: Which query is less expensive / faster?