Updated FSM display for VACUUM VERBOSE

Поиск
Список
Период
Сортировка
Искать

Updated FSM display for VACUUM VERBOSE

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
I have trouble understanding the current output of VACUUM VERBOSE when
it displays FSM information.

The current output is:
	
	INFO:  free space map: 49 relations, 17266 pages stored; 18768 total
	pages used
	DETAIL:  FSM size: 1000 relations + 18000 pages = 171 kB shared memory.
	NOTICE:  the number of page slots needed (18768) exceeds max_fsm_pages
	(18000)
	HINT:  Consider increasing the configuration parameter "max_fsm_relations"
	to a value over 18768.

The problem I have is that the relations part is mixed with the pages
part, and the numbers aren't easily comparable.  I have attached a patch
which makes the information easier to understand.  Here is one where the
FSM is large enough:
	
	INFO:  free space map: 48 relations with free space, maximum of 1000 relations trackable
	INFO:  35 pages stored, 768 pages used (with overhead)
	INFO:  768 pages required to store all freespace, maximum of 18000 pages allocatable (171 kB)
	
and one that is too small:

	INFO:  free space map: 49 relations with free space, maximum of 1000 relations trackable
	INFO:  17266 pages stored, 18000 pages used (with overhead)
	INFO:  18768 pages required to store all freespace, maximum of 18000 pages allocatable (171 kB)
	NOTICE:  the number of page slots needed (18768) exceeds max_fsm_pages (18000)
	HINT:  Consider increasing the configuration parameter "max_fsm_relations"
	to a value over 18768.

I find this output cleaner and easier to understand.  The "pages used"
value will match either the "required" or "maximum" value on the line
below.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/storage/freespace/freespace.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v
retrieving revision 1.39
diff -c -c -r1.39 freespace.c
*** src/backend/storage/freespace/freespace.c	14 Mar 2005 20:15:09 -0000	1.39
--- src/backend/storage/freespace/freespace.c	23 Apr 2005 04:03:09 -0000
***************
*** 691,696 ****
--- 691,697 ----
  	int			storedPages = 0;
  	int			numRels;
  	double		sumRequests;
+ 	double		extraChunks = 0;
  	double		needed;
  
  	LWLockAcquire(FreeSpaceLock, LW_EXCLUSIVE);
***************
*** 698,704 ****
--- 699,713 ----
  	for (fsmrel = FreeSpaceMap->firstRel;
  		 fsmrel != NULL;
  		 fsmrel = fsmrel->nextPhysical)
+ 	{
  		storedPages += fsmrel->storedPages;
+ 		if (!fsmrel->isIndex)
+ 			/* round so a full page doesn't count twice */
+ 			extraChunks += (fsmrel->storedPages-1) / CHUNKPAGES;
+ 		else
+ 			extraChunks += (fsmrel->storedPages-1) / INDEXCHUNKPAGES;
+ 	}
+ 
  	/* Copy other stats before dropping lock */
  	numRels = FreeSpaceMap->numRels;
  	sumRequests = FreeSpaceMap->sumRequests;
***************
*** 708,718 ****
  	needed = (sumRequests + numRels) * CHUNKPAGES;
  
  	ereport(elevel,
! 			(errmsg("free space map: %d relations, %d pages stored; %.0f total pages used",
! 					numRels, storedPages, needed),
! 			 errdetail("FSM size: %d relations + %d pages = %.0f kB shared memory.",
! 					   MaxFSMRelations, MaxFSMPages,
! 					   (double) FreeSpaceShmemSize() / 1024.0)));
  
  	CheckFreeSpaceMapStatistics(NOTICE, numRels, needed);
  	/* Print to server logs too because is deals with a config variable. */
--- 717,733 ----
  	needed = (sumRequests + numRels) * CHUNKPAGES;
  
  	ereport(elevel,
! 			(errmsg("free space map: %d relations with free space, maximum of %d relations trackable",
! 					numRels, MaxFSMRelations)));
! 
! 	ereport(elevel,
! 			(errmsg("%d pages stored, %.0f pages used (with overhead)",
! 					storedPages, (extraChunks + numRels) * CHUNKPAGES)));
! 
! 	ereport(elevel,
! 			(errmsg("%.0f pages required to store all freespace, maximum of %d pages allocatable (%.0f kB)",
! 					needed, MaxFSMPages,
! 				   (double) FreeSpaceShmemSize() / 1024.0)));
  
  	CheckFreeSpaceMapStatistics(NOTICE, numRels, needed);
  	/* Print to server logs too because is deals with a config variable. */

Re: Updated FSM display for VACUUM VERBOSE

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
pgman wrote:
> 	INFO:  free space map: 49 relations with free space, maximum of 1000 relations trackable
> 	INFO:  17266 pages stored, 18000 pages used (with overhead)
> 	INFO:  18768 pages required to store all freespace, maximum of 18000 pages allocatable (171 kB)
> 	NOTICE:  the number of page slots needed (18768) exceeds max_fsm_pages (18000)
> 	HINT:  Consider increasing the configuration parameter "max_fsm_relations"
> 	to a value over 18768.
> 
> I find this output cleaner and easier to understand.  The "pages used"
> value will match either the "required" or "maximum" value on the line
> below.

The "pages used" sentence above is wrong, and it seems the computation
is wrong too.  I just connected to another database, created, inserted,
and deleted rows from a table and see:

	INFO:  free space map: 50 relations with free space, maximum of 1000 
	relations trackable
	INFO:  17266 pages stored, 18016 pages used (with overhead)
	INFO:  18784 pages required to store all freespace, maximum of 18000
	pages allocatable (171 kB)
	NOTICE:  the number of page slots needed (18784) exceeds max_fsm_pages
	(18000)
	HINT:  Consider increasing the configuration parameter "max_fsm_relations"
	to a value over 18784.

The 'pages used' is greater than 18000, which isn't possible.  Seems I
have more work to do.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Updated FSM display for VACUUM VERBOSE

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Bruce Momjian wrote:
> pgman wrote:
> > 	INFO:  free space map: 49 relations with free space, maximum of 1000 relations trackable
> > 	INFO:  17266 pages stored, 18000 pages used (with overhead)
> > 	INFO:  18768 pages required to store all freespace, maximum of 18000 pages allocatable (171 kB)
> > 	NOTICE:  the number of page slots needed (18768) exceeds max_fsm_pages (18000)
> > 	HINT:  Consider increasing the configuration parameter "max_fsm_relations"
> > 	to a value over 18768.
> > 
> > I find this output cleaner and easier to understand.  The "pages used"
> > value will match either the "required" or "maximum" value on the line
> > below.
> 
> The "pages used" sentence above is wrong, and it seems the computation
> is wrong too.  I just connected to another database, created, inserted,
> and deleted rows from a table and see:
> 
> 	INFO:  free space map: 50 relations with free space, maximum of 1000 
> 	relations trackable
> 	INFO:  17266 pages stored, 18016 pages used (with overhead)
> 	INFO:  18784 pages required to store all freespace, maximum of 18000
> 	pages allocatable (171 kB)
> 	NOTICE:  the number of page slots needed (18784) exceeds max_fsm_pages
> 	(18000)
> 	HINT:  Consider increasing the configuration parameter "max_fsm_relations"
> 	to a value over 18784.
> 
> The 'pages used' is greater than 18000, which isn't possible.  Seems I
> have more work to do.

OK, I have simplified the patch.  It doesn't use any new computations
but just displays them differently.  The output is now:

	INFO:  free space map contains information about:
	INFO:  49 relations, limit 1000 relations
	INFO:  35 pages with free space, 784 pages (with overhead)
	INFO:  784 pages required to track all freespace, limit 18000 pages (171 kB)

I have committed this patch to HEAD.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/storage/freespace/freespace.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v
retrieving revision 1.39
diff -c -c -r1.39 freespace.c
*** src/backend/storage/freespace/freespace.c	14 Mar 2005 20:15:09 -0000	1.39
--- src/backend/storage/freespace/freespace.c	23 Apr 2005 15:18:21 -0000
***************
*** 699,704 ****
--- 699,705 ----
  		 fsmrel != NULL;
  		 fsmrel = fsmrel->nextPhysical)
  		storedPages += fsmrel->storedPages;
+ 
  	/* Copy other stats before dropping lock */
  	numRels = FreeSpaceMap->numRels;
  	sumRequests = FreeSpaceMap->sumRequests;
***************
*** 708,718 ****
  	needed = (sumRequests + numRels) * CHUNKPAGES;
  
  	ereport(elevel,
! 			(errmsg("free space map: %d relations, %d pages stored; %.0f total pages used",
! 					numRels, storedPages, needed),
! 			 errdetail("FSM size: %d relations + %d pages = %.0f kB shared memory.",
! 					   MaxFSMRelations, MaxFSMPages,
! 					   (double) FreeSpaceShmemSize() / 1024.0)));
  
  	CheckFreeSpaceMapStatistics(NOTICE, numRels, needed);
  	/* Print to server logs too because is deals with a config variable. */
--- 709,728 ----
  	needed = (sumRequests + numRels) * CHUNKPAGES;
  
  	ereport(elevel,
! 			(errmsg("free space map contains information about:")));
! 
! 	ereport(elevel,
! 			(errmsg("%d relations, limit %d relations",
! 					numRels, MaxFSMRelations)));
! 
! 	ereport(elevel,
! 			(errmsg("%d pages with free space, %.0f pages (with overhead)",
! 					storedPages, Min(needed, MaxFSMPages))));
! 
! 	ereport(elevel,
! 			(errmsg("%.0f pages required to track all freespace, limit %d pages (%.0f kB)",
! 					needed, MaxFSMPages,
! 				   (double) FreeSpaceShmemSize() / 1024.0)));
  
  	CheckFreeSpaceMapStatistics(NOTICE, numRels, needed);
  	/* Print to server logs too because is deals with a config variable. */

Re: Updated FSM display for VACUUM VERBOSE

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bruce Momjian  writes:
> OK, I have simplified the patch.  It doesn't use any new computations
> but just displays them differently.  The output is now:

> 	INFO:  free space map contains information about:
> 	INFO:  49 relations, limit 1000 relations
> 	INFO:  35 pages with free space, 784 pages (with overhead)
> 	INFO:  784 pages required to track all freespace, limit 18000 pages (171 kB)

This breaks the message style guidelines in a number of ways, and I
don't find it clear at all.

			regards, tom lane

Re: Updated FSM display for VACUUM VERBOSE

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Tom Lane wrote:
> Bruce Momjian  writes:
> > OK, I have simplified the patch.  It doesn't use any new computations
> > but just displays them differently.  The output is now:
> 
> > 	INFO:  free space map contains information about:
> > 	INFO:  49 relations, limit 1000 relations
> > 	INFO:  35 pages with free space, 784 pages (with overhead)
> > 	INFO:  784 pages required to track all freespace, limit 18000 pages (171 kB)
> 
> This breaks the message style guidelines in a number of ways, and I
> don't find it clear at all.

OK, what suggestions do you have, and how did I break the style
guidelines?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
FAQ