Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e23Da-0002oI-Au for pgsql-general@arkaria.postgresql.org; Tue, 10 Oct 2017 22:41:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e23DZ-0000xk-Kl for pgsql-general@arkaria.postgresql.org; Tue, 10 Oct 2017 22:41:41 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e23DZ-0000xT-4D for pgsql-general@postgresql.org; Tue, 10 Oct 2017 22:41:41 +0000 Received: from hogranch.com ([75.101.82.47]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e23DW-0007SO-1G for pgsql-general@postgresql.org; Tue, 10 Oct 2017 22:41:40 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id v9AMfVN32588 for ; Tue, 10 Oct 2017 15:41:31 -0700 Subject: Re: core system is getting unresponsive because over 300 cpu load To: pgsql-general@postgresql.org References: <1507668007464-0.post@n3.nabble.com> <4da39f8e-39b9-b4af-d879-72a44dde5fbd@2ndquadrant.com> <1507674532671-0.post@n3.nabble.com> From: John R Pierce Message-ID: <838d0ab3-6c4f-39d3-85a1-978402e07e01@hogranch.com> Date: Tue, 10 Oct 2017 15:41:26 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1507674532671-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 10/10/2017 3:28 PM, pinker wrote: > It was exactly my first guess. work_mem is set to ~ 350MB and I see a lot of > stored procedures with unnecessary WITH clauses (i.e. materialization) and > right after it IN query with results of that (hash). 1000 connections all doing queries that need 1 work_mem each will consume 1000*350MB == 350GB of your ram.    many queries use several work_mem's. if the vast majority of your operations are OLTP and only access a few rows, then large work_mem is NOT a good idea.   If you're doing large aggregate operations like OLAP for reporting or whatever, then thats another story, but generally doing that sort of thing does NOT use 1000 connections. -- john r pierce, recycling bits in santa cruz -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general