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 1hxaEH-0004X1-FZ for pgsql-general@arkaria.postgresql.org; Tue, 13 Aug 2019 17:05:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxaEE-0006Ht-QN for pgsql-general@arkaria.postgresql.org; Tue, 13 Aug 2019 17:04:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxaED-0006Hm-Uw for pgsql-general@lists.postgresql.org; Tue, 13 Aug 2019 17:04:58 +0000 Received: from smtp3.mail.ru ([94.100.179.58]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hxaE7-0007zp-HP for pgsql-general@postgresql.org; Tue, 13 Aug 2019 17:04:56 +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:References:Cc:To:From:Subject; bh=QjVXUIFD5hKi4fummE11vL/yFkvPSPQScuUggUCIIZQ=; b=Pk59/21t+w0kT1JOe0kzc8SeUqmBEOgRHOaBooMMOHOJ+gPfwPPaQgp/J8rXvtTeSpjX4VouK3soBbxgITt4xQ2njt0H25/ybYId4zUwIt8j3g68Xwvqh+O21UANyKZk/QjnlO1g+E0mtXhg8W9k6NWEDtNhUXLn59SHlRVmCDk=; Received: by smtp3.mail.ru with esmtpa (envelope-from ) id 1hxaE3-0003G2-Mb; Tue, 13 Aug 2019 20:04:48 +0300 Subject: Re: Changing work_mem From: rihad To: Luca Ferrari Cc: Peter Eisentraut , pgsql-general General References: <2cbec921-a0c2-016f-1831-82dd45106af3@mail.ru> <6d170b3b-17b7-8e02-bbf6-2a6885b317eb@mail.ru> <50c20aea-6f63-2cf7-1760-bb28679ff3e7@mail.ru> Message-ID: <9c6b069a-c99b-4b65-92fa-59404012e576@mail.ru> Date: Tue, 13 Aug 2019 21:04:45 +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: <50c20aea-6f63-2cf7-1760-bb28679ff3e7@mail.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Authentication-Results: smtp3.mail.ru; auth=pass smtp.auth=rihad@mail.ru smtp.mailfrom=rihad@mail.ru X-77F55803: 0014004E1F3277295A78504BD2AC2941ABDFC7E166457DED2D25CDFAE356213B206E8AD9565FE0A7A92B7141ECEBA5AE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70FEF15FEF2CD350AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637B57167876D7686B28638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC3093ED6137FE33933263F02EDA977A1CE0A4575855AF4E0B389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481FCF19DD082D7633A0E7DDDDC251EA7DABA471835C12D1D977725E5C173C3A84C34964A708C60C975A117882F4460429728AD0CFFFB425014E40A5AABA2AD371193AA81AA40904B5D9A18204E546F3947CEB7D890E3377C531BA3038C0950A5D36C8A9BA7A39EFB766BE1D6DAAD8F14AE176E601842F6C81A127C277FBC8AE2E8B3F904BEBCF17E58A3AA81AA40904B5D9C68CB3A264D9FF60A91E23F1B6B78B78D5E8D9A59859A8B6E91D18C7865A06F7CC17588A6D24AE6A5E1C53F199C2BB95B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBEB6346B700B4D54FE5BFE6E7EFDEDCD789D4C264860C145E X-Mailru-Sender: B19AB4DAF1EA2FB5AD9FC17C94DC39F50188059983C42CC5A8AE13A43264E24AE23824BA0C9766A7ABBFE0CF075BC50BFB559BB5D741EB96004FA9CEFBA991DA3A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: OK List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 08/13/2019 08:44 PM, rihad wrote: > 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. Sorry, I just decreased work_mem back to 256MB, reloaded, and instantly started seeing 82mb temp file creation, not 165mb as was usual with work_mem=512MB. So it indeed was applied immediately. Really weird figures )