Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSLor-0002dK-Mq for pgsql-admin@arkaria.postgresql.org; Fri, 02 Apr 2021 15:34:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lSLoq-0006aj-LE for pgsql-admin@arkaria.postgresql.org; Fri, 02 Apr 2021 15:34:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSLoq-0006ac-Dv for pgsql-admin@lists.postgresql.org; Fri, 02 Apr 2021 15:34:44 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lSLon-0002T2-O6 for pgsql-admin@lists.postgresql.org; Fri, 02 Apr 2021 15:34:44 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lSLoi-0000xM-Mk; Fri, 02 Apr 2021 11:34:36 -0400 Date: Fri, 2 Apr 2021 11:34:36 -0400 From: Bruce Momjian To: "Campbell, Lance" Cc: Laurenz Albe , MichaelDBA , SASIKUMAR Devaraj , "holger@jakobs.com" , "pgsql-admin@lists.postgresql.org" Subject: Re: work_mem Message-ID: <20210402153436.GE9270@momjian.us> References: <04D84259-1B75-4648-949F-78677916194E@jakobs.com> <66290583.2329958.1617367063840@mail.yahoo.com> <1654783699.2333997.1617367552583@mail.yahoo.com> <592e5895-8dbd-1a4f-a87c-af72ac8eea02@sqlexec.com> <339e1ee870881a3efaffc7ea4cddac6bc4d009cf.camel@cybertec.at> <20210402150736.GD9270@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Apr 2, 2021 at 03:25:04PM +0000, Campbell, Lance wrote: > Thanks for sharing this thread. My suggestion of having a work_mem_stack_size > is the same concept mentioned in this thread regarding having a work_mem_pool. > I prefer this later term rather than the one I was using. When the work mem > pool is exhausted PostgreSQL just uses temp files for work_mem. With current > statics for temp files and with a new stats on a work mem pool usage a user > could fine tune memory much more precisely. It would leave the “art of memory > tuning” behind. The other added benefit is that people would have a better > understanding of how work_mem is used by naturally having to explain what a > work_mem_pool is and when it is drawn on. There are probably a lot of > PostgreSQL instance that would run faster just by having the confidence to > increase the size of work_mem. I am sure many instances have this value set to > low. Uh, did you read the blog before it, referenced in that blog entry: https://momjian.us/main/blogs/pgblog/2018.html#December_7_2018 Even if we have a pool, it is still complex to configure memory, but it might help. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.