Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j47nd-00052O-7j for pgsql-performance@arkaria.postgresql.org; Tue, 18 Feb 2020 18:40:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j47na-00019S-T5 for pgsql-performance@arkaria.postgresql.org; Tue, 18 Feb 2020 18:40:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j47na-00019C-EG for pgsql-performance@lists.postgresql.org; Tue, 18 Feb 2020 18:40:46 +0000 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j47nX-0004xd-6y for pgsql-performance@postgresql.org; Tue, 18 Feb 2020 18:40:46 +0000 Received: by mail-yb1-xb43.google.com with SMTP id b141so10963522ybg.10 for ; Tue, 18 Feb 2020 10:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=x1oOs9eLq6dEeIASYKUlPfFm5ce2/roOEYTS/UhElU0=; b=nyjhJPcD5N8qTEbaTgdHJ1hjTnPSMLROm71e+QTgtJLw1zZBsjQffQmaGBaYlt5axX tcWweV2XiWuAmn5a2WROAhAheGAQLWRG8ty5RF2Grr5Xd6W5JlY64kFtSI8N3MhQIYs1 g5JK5Gp96nmoknMwCG/cfGaB6rTMEy+/6Dc19C7P7puu+1+BgHXsHJtAr5ePodJr6PiP enuVK+FfIAIZMWx9IFcmE45kxjgL1Yt3cx9Kt/1aU1QX55MfUpU/82iCR4FsE7l2ftwN RoQaRItwfRssfELO5lcG5B4X9EaIOu6lQZYXIt/bUXVRzTUoCwd4h5vM2Rrtj4L+aIZ6 OfWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=x1oOs9eLq6dEeIASYKUlPfFm5ce2/roOEYTS/UhElU0=; b=RlypGnSm+bE2tBsi2QVuvzW9WQDAxeGlri9Ep/GfzSV0O2ir2QZm1bxe7LASQQv+pF UsgekIOOgFTGMkgEiZYUazfyK6mnbL/6tJ6xmPVrZsmo44b9SuxCSVw+R8lcM5nbDgFL wwSRSdvC4IE/bNaCWBMrABlZRHUGW80zjBHUx4kzZmgQoTVIONv05ZTbL6Wz2GKryrol 6g0cQB1Tm018VqLIQNu37ReXKC7fsYaioK1ZlHRuSHwHxFwGukr9xiCOgHXXs5ZwBWtO f2t/JYeRSnCY9kAqpIti4Vti61A6a5EjREV/5LxDLDLYPbhvBRkTgTZVUPEhJM7XUrZV qtzA== X-Gm-Message-State: APjAAAVXh8lCFnPhRbz0bGra6rkr8qj1/ao9z7hRYYZsX0wnDaJUbzW0 L6hFkB2l/XA8PE9ZO04JtZ2kfnUr5qM= X-Google-Smtp-Source: APXvYqzAa9pfIfFk576e+OmziNPEfioqmiCs6Yo0Pb40YiG/P4nXauxAfPn27CywdwzWkTxS/ZGFzQ== X-Received: by 2002:a25:f205:: with SMTP id i5mr19749129ybe.97.1582051239459; Tue, 18 Feb 2020 10:40:39 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a202sm1975694ywe.8.2020.02.18.10.40.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2020 10:40:38 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 666F5800828; Tue, 18 Feb 2020 12:40:37 -0600 (CST) Date: Tue, 18 Feb 2020 12:40:37 -0600 From: Justin Pryzby To: Nagaraj Raj Cc: pgsql-performance@postgresql.org Subject: Re: DB running out of memory issues after upgrade Message-ID: <20200218184037.GZ31889@telsasoft.com> References: <1425420656.4660607.1582047988379.ref@mail.yahoo.com> <1425420656.4660607.1582047988379@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1425420656.4660607.1582047988379@mail.yahoo.com> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Please don't cross post to different lists. Pgsql-general , PgAdmin Support , PostgreSQL Hackers , "pgsql-hackers-owner@postgresql.org" , Postgres Performance List , Pg Bugs , Pgsql-admin , Pgadmin-hackers , PostgreSQL Hackers , Pgsql-pkg-yum On Tue, Feb 18, 2020 at 05:46:28PM +0000, Nagaraj Raj wrote: > after upgrade Postgres to v9.6.11 from v9.6.9 DB running out of memory issues no world load has changed before and after upgrade.  > > spec: RAM 16gb,4vCore On Tue, Feb 18, 2020 at 06:10:08PM +0000, Nagaraj Raj wrote: > Below are the same configurations ins .conf file before and after updagrade > show max_connections; = 1743 > show shared_buffers = "4057840kB" > show work_mem = "4MB" > show maintenance_work_mem = "259MB" > Any bug reported like this or suggestions on how to fix this issue? I appreciate the response..!!  > > I could see below error logs and due to this reason database more often going into recovery mode,  What do you mean "more often" ? Did the crash/OOM happen before the upgrade, too ? > 2020-02-17 22:34:32 UTC::@:[20467]:LOG: server process (PID32731) was terminated by signal 9: Killed > 2020-02-17 22:34:32 UTC::@:[20467]:DETAIL:Failed process was running: selectinfo_starttime,info_starttimel,info_conversationid,info_status,classification_type,intentname,confidencescore,versions::text,messageidfrom salesdb.liveperson.intents where info_status='CLOSE' AND ( 1=1 ) AND ( 1=1) That process is the one which was killed (in this case) but maybe not the process responsible for using lots of *private* RAM. Is salesdb.liveperson.intents a view ? What is the query plain for that query ? (Run it with "explain"). https://wiki.postgresql.org/wiki/SlowQueryQuestions#EXPLAIN_.28ANALYZE.2C_BUFFERS.29.2C_not_just_EXPLAIN https://wiki.postgresql.org/wiki/Guide_to_reporting_problems On Tue, Feb 18, 2020 at 06:10:08PM +0000, Nagaraj Raj wrote: > I identified one simple select which consuming more memory and here is the query plan, > > "Result  (cost=0.00..94891854.11 rows=3160784900 width=288)""  ->  Append  (cost=0.00..47480080.61 rows=3160784900 width=288)""        ->  Seq Scan on msghist  (cost=0.00..15682777.12 rows=3129490000 width=288)""              Filter: (((data -> 'info'::text) ->> 'status'::text) = 'CLOSE'::text)""        ->  Seq Scan on msghist msghist_1  (cost=0.00..189454.50 rows=31294900 width=288)""              Filter: (((data -> 'info'::text) ->> 'status'::text) = 'CLOSE'::text)" This is almost certainly unrelated. It looks like that query did a seq scan and accessed a large number of tuples (and pages from "shared_buffers"), which the OS then shows as part of that processes memory, even though *shared* buffers are not specific to that one process. -- Justin