Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC2fP-0007lL-II for pgsql-admin@arkaria.postgresql.org; Fri, 27 Apr 2018 12:39:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fC2fN-0004gc-PF for pgsql-admin@arkaria.postgresql.org; Fri, 27 Apr 2018 12:39:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC2fN-0004gS-E3 for pgsql-admin@lists.postgresql.org; Fri, 27 Apr 2018 12:39:57 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fC2fJ-0000qf-Qu for pgsql-admin@postgresql.org; Fri, 27 Apr 2018 12:39:56 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 1D51A42E8B; Fri, 27 Apr 2018 14:39:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id qfgpzetoztq2; Fri, 27 Apr 2018 14:39:48 +0200 (CEST) Message-ID: <1524832787.2467.23.camel@cybertec.at> Subject: Re: vacuumdb causes memory drain. From: Laurenz Albe To: Sushil Shirodkar Cc: Don Seiler , "pgsql-admin@postgresql.org" Date: Fri, 27 Apr 2018 14:39:47 +0200 In-Reply-To: References: <1524809191.2382.4.camel@cybertec.at> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Sushil Shirodkar wrote: > > > > > On Thu, Apr 26, 2018 at 10:31 AM, Sushil Shirodkar wrote: > > > > > Running "vacuumdb -a -z -v" from the cron on one of our test environment, and > > > > > noticed that memory of the server goes down from 3.4GB free to 150MB. Once > > > > > the process is over, memory is not released, is it normal or something needs to be > > > > > changed ? also other processes start running slow afterwards due to low memory. > > > > > > > > How are you measuring free memory? Memory might be listed in cached/buffers instead of > > > > free but is still available. Although that wouldn't then explain other processes being slow. > > > > > > I have put some small script which runs in a loop with "free -h" command, > > > while I am running "vacuumdb". Once I clear by "sync" or bounce PG, > > > everything runs normal afterward. > > > > Then I would say everything is fine. > > It is normal for a Linux system to have almost no free memory; the memory is used > > for the file system cache. > > > > Do you experience any problems, like reduced performance or high I/O? > > > Performance issue. > > Can I restrict memory usage at session level in the script where I run > Vacuum DB ? Could you please bottom-post? Once vacuumdb is done, the associated backend process is gone too, so it cannot consume any memory. Try to figure out which process consumes your memory. What do you get for free -h? How did you configure shared_buffers and maintenance_work_mem? Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com