Re: Advice on selecting good values for work_mem?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In response to Tom Lane <tgl@xxxxxxxxxxxxx>:

> Bill Moran <wmoran@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> > Does the creation of a temp file trigger any logging?
> 
> No; but it wouldn't be hard to add some if you wanted.  I'd do it at
> deletion, not creation, so you could log the size the file reached.
> See FileClose() in src/backend/storage/file/fd.c.

Is this along the lines of what you were thinking?  Is this acceptable
to get pulled into the tree (maintaining local patches sucks ;)  I've
only been using this patch a day and I'm already giddy about how much
it helps tuning work memory sizes ...

-- 
Bill Moran
Collaborative Fusion Inc.
*** fd.c.prev	Mon Dec 18 16:09:51 2006
--- fd.c	Mon Dec 18 16:09:31 2006
***************
*** 939,944 ****
--- 939,945 ----
  FileClose(File file)
  {
  	Vfd		   *vfdP;
+ 	struct stat  u	filestats;
  
  	Assert(FileIsValid(file));
  
***************
*** 968,973 ****
--- 969,982 ----
  	{
  		/* reset flag so that die() interrupt won't cause problems */
  		vfdP->fdstate &= ~FD_TEMPORARY;
+ 	if (fstat(vfdP->fd, &filestats)) {
+ 		ereport(WARNING,
+ 			(errmsg("A temporary file of %d bytes was used",
+ 				filestats.st_size),
+ 				errhint("You many need to increase work_mem.")));
+ 	} else {
+ 		elog(ERROR, "Could not stat \"%s\": %m", vfdP->fileName);
+ 	}
  		if (unlink(vfdP->fileName))
  			elog(LOG, "failed to unlink \"%s\": %m",
  				 vfdP->fileName);

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux