Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sc4Fl-003cbV-DU for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Aug 2024 14:36:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sc4Fj-00Esah-Ex for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Aug 2024 14:36:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sc4Fj-00EsaZ-6g for pgsql-bugs@lists.postgresql.org; Thu, 08 Aug 2024 14:36:31 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sc4Fg-003imd-Og for pgsql-bugs@lists.postgresql.org; Thu, 08 Aug 2024 14:36:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 478EaQg42223507; Thu, 8 Aug 2024 10:36:26 -0400 From: Tom Lane To: =?UTF-8?B?QWxlxaEgWmVsZW7DvQ==?= cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18573: Analyze command consumes several GB of memory - more than analyzed table size In-reply-to: References: <18573-4bd97c0c25e99339@postgresql.org> <1959772.1723041966@sss.pgh.pa.us> Comments: In-reply-to =?UTF-8?B?QWxlxaEgWmVsZW7DvQ==?= message dated "Thu, 08 Aug 2024 10:31:38 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2223505.1723127786.1@sss.pgh.pa.us> Date: Thu, 08 Aug 2024 10:36:26 -0400 Message-ID: <2223506.1723127786@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?UTF-8?B?QWxlxaEgWmVsZW7DvQ==?= writes: > the default statistics target is: > 2500 > So I've changed it to the default: > powa=# ALTER TABLE testcase_t3 ALTER COLUMN records SET STATISTICS 100; > The memory consumption drops down to ~ 1.1GB > So you were right, thanks! Yeah, the array statistics collection code is a bit of a memory hog compared to most other data types. I'm not sure that's a bug exactly; there are more kinds of stats that we want to collect for arrays, such as per-element stats. regards, tom lane