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 1hxZuZ-0003nR-HJ for pgsql-general@arkaria.postgresql.org; Tue, 13 Aug 2019 16:44:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxZuY-0001vF-83 for pgsql-general@arkaria.postgresql.org; Tue, 13 Aug 2019 16:44:38 +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 1hxZuX-0001tO-QF for pgsql-general@lists.postgresql.org; Tue, 13 Aug 2019 16:44:37 +0000 Received: from smtp39.i.mail.ru ([94.100.177.99]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxZuV-0000sO-0p for pgsql-general@postgresql.org; Tue, 13 Aug 2019 16:44:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=Sv5o3E55LuRDZAdR68Gm7/zQySB9GToyVW35mkQvuuo=; b=EuVLTMnutfS4M8D+Czch5hH6Vxu5PBInKSNp3kq84x4BoGW6DgZpfyNZ70v7DyljRzAF62RO7mvi4yud8i65+WhCAK44jbCuSzMr31O1R6uWuwRcG7e5aOA5Bdpl1ubfdKviSskPmT7KC35MeAI+IpFhXZYMxoSwAisNwiWlEoI=; Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1hxZuT-0000fV-Dr; Tue, 13 Aug 2019 19:44:33 +0300 Subject: Re: Changing work_mem To: Luca Ferrari Cc: Peter Eisentraut , pgsql-general General References: <2cbec921-a0c2-016f-1831-82dd45106af3@mail.ru> <6d170b3b-17b7-8e02-bbf6-2a6885b317eb@mail.ru> From: rihad Message-ID: <50c20aea-6f63-2cf7-1760-bb28679ff3e7@mail.ru> Date: Tue, 13 Aug 2019 20:44:31 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: smtp39.i.mail.ru; auth=pass smtp.auth=rihad@mail.ru smtp.mailfrom=rihad@mail.ru X-77F55803: E14BCC6235C710295A78504BD2AC2941ABDFC7E166457DED6747BF7730AFB604C9AA1094DB5B1CE7F47C447361F564C9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE763D33D3AF3325E31EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374FBBFB70E81E08C88638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCD3871748D871613E158F3C9B03CD4FE2DC93FE92841C2C2A389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0A3E989B1926288338941B15DA834481FCF19DD082D7633A0E7DDDDC251EA7DABA471835C12D1D977725E5C173C3A84C3E478A468B35FE767117882F4460429728AD0CFFFB425014E40A5AABA2AD371193AA81AA40904B5D9A18204E546F3947CEE16715F795C715CBA3038C0950A5D36C8A9BA7A39EFB766BE1D6DAAD8F14AE176E601842F6C81A127C277FBC8AE2E8BC3A6C3062C32747B3AA81AA40904B5D9C68CB3A264D9FF60A91E23F1B6B78B78D5E8D9A59859A8B6E91D18C7865A06F7988274F8CAAA49D4156CCFE7AF13BCA4B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBEB6346B700B4D54FE5BFE6E7EFDEDCD789D4C264860C145E X-Mailru-Sender: B19AB4DAF1EA2FB5AD9FC17C94DC39F530E42061518A33D12FCF85AB94928CE6E06E9EA040CFE582ABBFE0CF075BC50BFB559BB5D741EB96004FA9CEFBA991DA3A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 08/13/2019 08:22 PM, Luca Ferrari wrote: > On Tue, Aug 13, 2019 at 5:59 PM rihad wrote: >> [dbname] LOG: temporary file: path >> "base/pgsql_tmp/pgsql_tmp93683.257381", size 594 >> > The setting 'work_mem' is within context 'user', that means it will > affect running sessione unless the session itself has already issued a > SET work_mem to xxx. > So this could be a reason why you don't seem to see any change. > > Also keep in mind that work_mem work on a connection basis, so you are > going to possibly see 521MB x num_connections if all your clients are > doig the same kind of sort concurrently, which probably causes > PostgreSQL to go to disk due to memory unavailable. > > Hope this helps. > Luca > . > Thanks. The box has 15GB mem free (as in FreeBSD ))) And it hasn't moved a notch after the increase. No code does SET work_mem=... AFAIK. My apologies to Mr. Peter but I still think that older processes, some of them started a couple of weeks ago, use the older setting. ps -auxww output: postgres   2705   43.6 27.5 34668984 27486640  -  Rs 14:00         3:15.31 postgres: dbname dbname 192.168.0.4(60614)  (postgres) postgres   7135   25.6 29.5 34437560 29499336  -  Ss Mon07        19:12.55 postgres: dbname dbname 192.168.0.4(23540)  (postgres) postgres  99760   14.8 25.9 34425200 25901744  -  Ss 13:10        57:31.86 postgres: dbname dbname 192.168.0.4(29650)  (postgres) postgres  28308    9.2 32.0 34445752 32050372  -  Ss 5Aug19      83:59.83 postgres: dbname dbname 192.168.0.3(59717) (postgres) postgres  21835    6.8 32.7 34451896 32750048  -  Ss Tue18       266:10.50 postgres: dbname dbname 192.168.0.3(60080)  (postgres) postgres  31957    5.2 31.7 34443704 31703072  -  Ss Mon14        29:21.74 postgres: dbname dbname 192.168.0.3(40905)  (postgres) postgres   2640    4.0 28.7 34435512 28667216  -  Ss 13:59         4:10.96 postgres: dbname dbname 192.168.0.4(60537)  (postgres) postgres  16727    4.0 32.9 34439608 32948936  -  Ss 2Aug19     316:14.67 postgres: dbname dbname 192.168.0.3(20897) (postgres) postgres  99672    3.6 28.3 34439608 28347760  -  Ss 13:08         7:05.25 postgres: dbname dbname 192.168.0.3(35980)  (postgres) postgres  48532    3.2 33.1 34451896 33078900  -  Ss 23Jul19     374:10.75 postgres: dbname dbname 192.168.0.3(59891)  (postgres) postgres   7141    2.8 31.6 34441656 31622616  -  Ss Mon07        38:19.36 postgres: dbname dbname 192.168.0.4(23618)  (postgres) postgres  14065    2.8 30.6 34431404 30568776  -  Ss Mon10        95:06.20 postgres: dbname dbname 192.168.0.4(65211)  (postgres)