Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jun 2005 19:12:19 -0400
From:      Tom Lane <tgl@sss.pgh.pa.us>
To:        Sven Willenberger <sven@dmv.com>
Cc:        Vivek Khera <vivek@khera.org>, stable@freebsd.org, postgres general <pgsql-general@postgresql.org>
Subject:   Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for 
Message-ID:  <165.1120086739@sss.pgh.pa.us>
In-Reply-To: <1120084441.19614.87.camel@lanshark.dmv.com> 
References:  <1120050088.19603.7.camel@lanshark.dmv.com> <58067976-00C6-4380-90DF-F448D9008C81@khera.org> <1120075946.19603.68.camel@lanshark.dmv.com> <51C9ABA2-20B8-4DE8-B647-A26A168A78FC@mac.com> <1120078715.19598.79.camel@lanshark.dmv.com> <1120084441.19614.87.camel@lanshark.dmv.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sven Willenberger <sven@dmv.com> writes:
> I have found the answer/problem. On a hunch I increased maxdsiz to 1.5G
> in the loader.conf file and rebooted. I ran vacuumdb and watched top as
> the process proceeded. What I saw was SIZE sitting at 603MB (which was
> 512MB plus another 91MB which corresponded nicely to the value of RES
> for the process. A bit into the process I saw SIZE jump to 1115 -- i.e.
> another 512 MB of RAM was requested and this time allocated. At one
> point SIZE dropped back to 603 and then back up to 1115. I suspect the
> same type of issue was occuring in regular vacuum from the psql client
> connecting to the backend, for some reason not as frequently. I am
> gathering that maintenance work mem is either not being recognized as
> having already been allocated and another malloc is made or the process
> is thinking the memory was released and tried to grab a chunk of memory
> again.

Hmm.  It's probably a fragmentation issue.  VACUUM will allocate a 
maintenance work mem-sized chunk during command startup, but that's
likely not all that gets allocated, and if any stuff allocated after
it is not freed at the same time, the process size won't go back down.
Which wouldn't be a killer in itself, but unless the next iteration
is able to fit that array in the same space, you'd see the above
behavior.

BTW, do you have any evidence that it's actually useful to set
maintenance work mem that high for VACUUM?  A quick and dirty solution
would be to bound the dead-tuples array size at something more sane...

			regards, tom lane



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?165.1120086739>