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

2005-02-25 Thread Ron Mayer

On Fri, 25 Feb 2005, Bruce Momjian wrote:
> Tom Lane wrote:
> > Ron Mayer <[EMAIL PROTECTED]> writes:
> > > Should the relation overflow be a WARNING or a LOG?  ...
> > I'd go for making them both LOG, I think.  More consistent.
>
> Can we also update this wording:
> 
> INFO:  free space map: 52 relations, 61 pages stored; 848 total pages needed
> DETAIL:  Allocated FSM size: 1000 relations + 2 pages = 182 kB shared 
> memory.
> 
> The "pages needed" is confusing.  In fact it is the total pages used or
> allocated.  I looked in the code and got confused.  It needs clarity. 


Any preference?   To me, "allocated" has some risk of sounding like
it refers to the total free space map (memory allocated for fsm)
instead of just the used ones."Allocated" is actually used for
that other meaning on the next line.  I guess it's confusing there
too, so that line should be changed as well.

How about if I go for "used" in that first line; and simply remove the
word "Allocated" in the DETAIL line.

So instead of:
>
> INFO:  free space map: 52 relations, 61 pages stored; 848 total pages needed
> DETAIL:  Allocated FSM size: 1000 relations + 2 pages = 182 kB shared 
> memory.
>
it'll say
>
> INFO:  free space map: 52 relations, 61 pages stored; 848 total pages used
> DETAIL:  FSM size: 1000 relations + 2 pages = 182 kB shared memory.
>


With those changes, the patch now looks like this...


==

% 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.c2004-12-31 
14:00:54.0 -0800
+++ postgresql-patched/src/backend/storage/freespace/freespace.c2005-02-25 
16:45:26.773792440 -0800
@@ -705,12 +705,25 @@
 /* Convert stats to actual number of page slots needed */
 needed = (sumRequests + numRels) * CHUNKPAGES;
 
-ereport(elevel,
-(errmsg("free space map: %d relations, %d pages stored; %.0f total 
pages needed",
+ereport(INFO,
+(errmsg("free space map: %d relations, %d pages stored; %.0f total 
pages used",
 numRels, storedPages, needed),
- errdetail("Allocated FSM size: %d relations + %d pages = %.0f kB 
shared memory.",
+ errdetail("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 for max_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)));
+
 }
 
 /*
==


Getting closer?


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [PATCHES] [pgsql-hackers-win32] Repleacement for src/port/snprintf.c

2005-02-25 Thread Nicolai Tufar
On Thu, 24 Feb 2005 22:18:11 -0500, Tom Lane <[EMAIL PROTECTED]> wrote:
> Didn't we do that already?

No :(   I promised to do it a couple of weeks ago but could not get to do it.
Now with Magnus's help I finaly did it. The last patch should be fine.

> regards, tom lane
Nicolai

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings