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 1pZxoU-0003as-D3 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Mar 2023 17:42:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pZxoT-0004WW-8o for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Mar 2023 17:42:53 +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 1pZxoS-0004WL-Si for pgsql-hackers@lists.postgresql.org; Wed, 08 Mar 2023 17:42:52 +0000 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZxoQ-0006tS-C2 for pgsql-hackers@postgresql.org; Wed, 08 Mar 2023 17:42:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1678297371; x=1709833371; h=message-id:date:mime-version:to:cc:references:from: in-reply-to:subject; bh=VTOseLWEYwJ1ig4V9RFwGz+CMfe//QkLcUHiU+fDiic=; b=JBTDWhiKQ7aXHP9yuxlrwu//UMONBmGLo6xHuZvQCzXwWv6gLnKf+ACu bdNuYei9h3gUN1Vby49JES48UWrnVi+FPhNTG8dF48dgrz1XJ84DQwDC3 Y9yX+4ia/YJEQJbD1XKyJG6qmOVtoSxR/FDEdwqCIdDyQPaVGVD9ZjA+o c=; X-IronPort-AV: E=Sophos;i="5.98,244,1673913600"; d="scan'208,217";a="300914954" Subject: Re: Should vacuum process config file reload more often Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-iad-1a-m6i4x-366646a6.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2023 17:42:47 +0000 Received: from EX13MTAUWC002.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-iad-1a-m6i4x-366646a6.us-east-1.amazon.com (Postfix) with ESMTPS id 1AF78ABE34; Wed, 8 Mar 2023 17:42:45 +0000 (UTC) Received: from EX19D003UWC001.ant.amazon.com (10.13.138.144) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.45; Wed, 8 Mar 2023 17:42:34 +0000 Received: from [192.168.2.226] (10.106.178.12) by EX19D003UWC001.ant.amazon.com (10.13.138.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.24; Wed, 8 Mar 2023 17:42:33 +0000 Content-Type: multipart/alternative; boundary="------------9BLD7ekdFtG7j36AoJ7DPzPZ" Message-ID: <7121ac43-d6ae-33ca-8ddc-538b0c6ab492@amazon.com> Date: Wed, 8 Mar 2023 11:42:31 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Masahiko Sawada , Melanie Plageman CC: Pg Hackers , Andres Freund References: From: Jim Nasby In-Reply-To: X-Originating-IP: [10.106.178.12] X-ClientProxiedBy: EX19D041UWA002.ant.amazon.com (10.13.139.121) To EX19D003UWC001.ant.amazon.com (10.13.138.144) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --------------9BLD7ekdFtG7j36AoJ7DPzPZ Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit On 3/2/23 1:36 AM, Masahiko Sawada wrote: >>>> For example, I guess we will need to take care of changes of >>>> maintenance_work_mem. Currently we initialize the dead tuple space at >>>> the beginning of lazy vacuum, but perhaps we would need to >>>> enlarge/shrink it based on the new value? Doesn't the dead tuple space grow as needed? Last I looked we don't allocate up to 1GB right off the bat. >>> I don't think we need to do anything about that initially, just because the >>> config can be changed in a more granular way, doesn't mean we have to react to >>> every change for the current operation. >> Perhaps we can mention in the docs that a change to maintenance_work_mem >> will not take effect in the middle of vacuuming a table. But, Ithink it probably >> isn't needed. > Agreed. I disagree that there's no need for this. Sure, if maintenance_work_memory is 10MB then it's no big deal to just abandon your current vacuum and start a new one, but the index vacuuming phase with maintenance_work_mem set to say 500MB can take quite a while. Forcing a user to either suck it up or throw everything in the phase away isn't terribly good. Of course, if the patch that eliminates the 1GB vacuum limit gets committed the situation will be even worse. While it'd be nice to also honor maintenance_work_mem getting set lower, I don't see any need to go through heroics to accomplish that. Simply recording the change and honoring it for future attempts to grow the memory and on future passes through the heap would be plenty. All that said, don't let these suggestions get in the way of committing this. Just having the ability to tweak cost parameters would be a win. --------------9BLD7ekdFtG7j36AoJ7DPzPZ Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: 7bit

On 3/2/23 1:36 AM, Masahiko Sawada wrote:

For example, I guess we will need to take care of changes of
maintenance_work_mem. Currently we initialize the dead tuple space at
the beginning of lazy vacuum, but perhaps we would need to
enlarge/shrink it based on the new value?
Doesn't the dead tuple space grow as needed? Last I looked we don't allocate up to 1GB right off the bat.
I don't think we need to do anything about that initially, just because the
config can be changed in a more granular way, doesn't mean we have to react to
every change for the current operation.
Perhaps we can mention in the docs that a change to maintenance_work_mem
will not take effect in the middle of vacuuming a table. But, Ithink it probably
isn't needed.
Agreed.

I disagree that there's no need for this. Sure, if maintenance_work_memory is 10MB then it's no big deal to just abandon your current vacuum and start a new one, but the index vacuuming phase with maintenance_work_mem set to say 500MB can take quite a while. Forcing a user to either suck it up or throw everything in the phase away isn't terribly good.

Of course, if the patch that eliminates the 1GB vacuum limit gets committed the situation will be even worse.

While it'd be nice to also honor maintenance_work_mem getting set lower, I don't see any need to go through heroics to accomplish that. Simply recording the change and honoring it for future attempts to grow the memory and on future passes through the heap would be plenty.

All that said, don't let these suggestions get in the way of committing this. Just having the ability to tweak cost parameters would be a win.

--------------9BLD7ekdFtG7j36AoJ7DPzPZ--