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 1pUbSK-0007Bv-B2 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Feb 2023 22:49:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUbSI-0002Gx-Ho for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Feb 2023 22:49:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUbSI-0002Go-4v for pgsql-hackers@lists.postgresql.org; Tue, 21 Feb 2023 22:49:50 +0000 Received: from smtp-fw-80006.amazon.com ([99.78.197.217]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUbSE-0002rY-Ji for pgsql-hackers@postgresql.org; Tue, 21 Feb 2023 22:49:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1677019787; x=1708555787; h=message-id:date:mime-version:to:cc:references:from: in-reply-to:content-transfer-encoding:subject; bh=pjYo915z47Fc8GaH9vprKeWgBL+PZPp1d9yc1omtizM=; b=kluixYmNQIJ8/ZxVMZReeVdSIM+6nuye0bnSOFIOZERrWzAKJnj9WlnE WHfEcSUAkWibA6jpmwTgo1feZKsJ7kVP5VKlV6nAzCASgbmFEO/res6Si hdsuuJlX2ot4PlsfPfDqtavI+9y3GUCg9k9+7tB+tfRLiMp5iH6WW/x8t U=; X-IronPort-AV: E=Sophos;i="5.97,317,1669075200"; d="scan'208";a="184670928" Subject: Re: refactoring relation extension and BufferAlloc(), faster COPY Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-pdx-2a-m6i4x-d47337e0.us-west-2.amazon.com) ([10.25.36.210]) by smtp-border-fw-80006.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2023 22:49:43 +0000 Received: from EX13MTAUWC001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2a-m6i4x-d47337e0.us-west-2.amazon.com (Postfix) with ESMTPS id 6851F610F1; Tue, 21 Feb 2023 22:49:42 +0000 (UTC) Received: from EX19D003UWC001.ant.amazon.com (10.13.138.144) by EX13MTAUWC001.ant.amazon.com (10.43.162.135) with Microsoft SMTP Server (TLS) id 15.0.1497.45; Tue, 21 Feb 2023 22:49:41 +0000 Received: from [10.95.212.163] (10.95.212.163) 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; Tue, 21 Feb 2023 22:49:39 +0000 Message-ID: <2f2b4022-d39d-5e32-b738-1672a593ba83@amazon.com> Date: Tue, 21 Feb 2023 16:49:37 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-US To: Andres Freund CC: , Thomas Munro , Melanie Plageman , Yura Sokolov , Robert Haas References: <20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de> <20230221211256.ibxhwtdrvytr2hpt@awork3.anarazel.de> From: Jim Nasby In-Reply-To: <20230221211256.ibxhwtdrvytr2hpt@awork3.anarazel.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.95.212.163] X-ClientProxiedBy: EX19D041UWB003.ant.amazon.com (10.13.139.176) 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 On 2/21/23 3:12 PM, Andres Freund wrote: > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. > > > > Hi, > > On 2023-02-21 15:00:15 -0600, Jim Nasby wrote: >> Some food for thought: I think it's also completely fine to extend any >> relation over a certain size by multiple blocks, regardless of concurrency. >> E.g. 10 extra blocks on an 80MB relation is 0.1%. I don't have a good feel >> for what algorithm would make sense here; maybe something along the lines of >> extend = max(relpages / 2048, 128); if extend < 8 extend = 1; (presumably >> extending by just a couple extra pages doesn't help much without >> concurrency). > I previously implemented just that. It's not easy to get right. You can easily > end up with several backends each extending the relation by quite a bit, at > the same time (or you re-introduce contention). Which can end up with a > relation being larger by a bunch if data loading stops at some point. > > We might want that as well at some point, but the approach implemented in the > patchset is precise and thus always a win, and thus should be the baseline. Yeah, what I was suggesting would only make sense when there *wasn't* contention.