I find this tiny (9-line) patch useful to help my clients know
when FSM settings may need updating.
Some of the more frequently asked questions here are in regards to FSM
settings. One hint I've seen is to run "vacuum verbose;". At the end
of thousands of lines of INFO and DETAIL messages vacuum verbose has 2
separate lines with some numbers to compare ("total pages needed" and
"FSM size...pages") that help indicate too low fsm settings.
I've gotten into the habit of always installing the following patch
(below) that automatically does this comparison for me, and if
max_fsm_pages is too small, it logs a warning as shown here:
WARNING: max_fsm_pages(1601) is smaller than total pages needed(2832)
I find this much nicer than the existing output (
clean=# vacuum verbose;
[......... thousands of lines of INFO and DETAIL messages ........]
INFO: free space map: 77 relations, 470 pages stored; 2832 total pages needed
DETAIL: Allocated FSM size: 100 relations + 1601 pages = 19 kB shared memory.
) for many reasons:
* First, because it's a warning, lots of people will notice it before
their asking the FAQ again.
* Second, because all the information is on a single line and actually
contains the string "max_fsm_relations", it gives people a clue what
to do about it. (note that vacuum verbose uses similar phrases but
from the number of questions here, it must not be obvious)
* Third, I don't need the 'verbose' setting.
* And most importantly, our clients let us know about WARNINGs,
but not about INFOs or DETAILs in their log page; so it gives
us a chance to respond before their system drags to a halt.
If a patch like this could get into the standard distro, that'd be
awesome - just let me know what additional work is needed (I didn't
look at docs or internationalization yet). If not, I'd like to post
it here to patches just in case anyone else will benefit from the
% diff -u postgresql-8.0.1/src/backend/storage/freespace/freespace.c
--- postgresql-8.0.1/src/backend/storage/freespace/freespace.c 2004-12-31
+++ postgresql-patched/src/backend/storage/freespace/freespace.c 2005-02-23
@@ -704,6 +704,15 @@
/* Convert stats to actual number of page slots needed */
needed = (sumRequests + numRels) * CHUNKPAGES;
+ if (needed > MaxFSMPages)
+ (errmsg("max_fsm_pages(%d) is smaller than total pages
+ MaxFSMPages, needed)));
+ if (numRels > MaxFSMRelations)
+ (errmsg("max_fsm_relations(%d) is smaller than the number of
+ MaxFSMRelations, numRels)));
(errmsg("free space map: %d relations, %d pages stored; %.0f total
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]