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 1pQxyp-0001YY-OK for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Feb 2023 22:04:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQxyn-0005WQ-07 for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Feb 2023 22:04:21 +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 1pQxym-0005WH-Mq for pgsql-hackers@lists.postgresql.org; Sat, 11 Feb 2023 22:04:20 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQxyk-0006kT-Fc for pgsql-hackers@postgresql.org; Sat, 11 Feb 2023 22:04:19 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id BEDF132000EB; Sat, 11 Feb 2023 17:04:15 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 11 Feb 2023 17:04:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1676153055; x=1676239455; bh=JObynWP0d9 LAl3l9929mztbLZ4tcIRwW0Sta8oJfpFU=; b=OzSYy5NMImcIEKiFgq7OpUGd+c w0RntpA7+geQN4VcTRt6/V7DPDmxpo1t/JXph4FsLzG64I/KBv/RYHRu3b3Hwu80 nPDTW2pRvcmT0s2xGXXiotm8z4ryoeZyXbuB8/514hJzHUbKzVbQvCbHQXfuWMR4 THiXIHqZVUP0rWvnB+PPpQpWx66kqDdkUjECjo/8aKDusyuKKPDXXdJxt+26oCLF fa4N09qPw0WB+Bos0wh9b55wg6N9qZvF3Y+rTJuHxyMiXmB+Qm5F5tkGotUwDXSw VwwZjWqY2rlIwJj3sIbDUkB9pRAAHowMofnG24pdAP5S8z0v7F0YfzkiCTxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1676153055; x=1676239455; bh=JObynWP0d9LAl3l9929mztbLZ4tc IRwW0Sta8oJfpFU=; b=LcqDXf2HvCKdymdeeYz3teXcEbh0SrRAKLHrkysLWvcR mL6nuK2/ir5zxSrk7/4wSz5aKU/MUONJkjPQu40XC+YWLk0cIqBkpTSyp7I7MJv3 V3Fv04StuZCkwBJ5Y5nLcM9AIPvqnGJw+bkvJbg29og1OgWU5AItV2YHdnEPp11b bihwSD7fB7+5fj/o6DEIFTtwEeaQqkMv4PpnrVGW3gMna4g+3u+h0zSN3uBbO03/ 0EGJGGN119eceKic+Nz68YMjkl3FCgFgAWcxhgqoxpwKRtdUyBPt7YTUUbHeFOu/ mZ8nnVcQwuduwFTo1MuPrnCR7KiWBDJ38sdVjYKJ2w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehjedgudehhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 11 Feb 2023 17:04:14 -0500 (EST) Date: Sat, 11 Feb 2023 14:04:13 -0800 From: Andres Freund To: Heikki Linnakangas Cc: vignesh C , pgsql-hackers@postgresql.org, Thomas Munro , Melanie Plageman , Yura Sokolov , Robert Haas , David Rowley Subject: Re: refactoring relation extension and BufferAlloc(), faster COPY Message-ID: <20230211220413.mrbdmlmgmaqzrcff@awork3.anarazel.de> References: <20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de> <20230110020749.uvi7dfrdvdqlhgal@awork3.anarazel.de> <419312fd-9255-078c-c3e3-f0525f911d7f@iki.fi> <20230211213651.pu4ns2764fxpyit5@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230211213651.pu4ns2764fxpyit5@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-02-11 13:36:51 -0800, Andres Freund wrote: > Even though it's not a correctness issue, it seems to me that > DropRelationsAllBuffers() etc ought to check if the buffer is BM_TAG_VALID, > before doing anything further. Particularly in DropRelationsAllBuffers(), the > check we do for each buffer isn't cheap. Doing it for buffers that don't even > have a tag seems .. not smart. There's a small regression for a single relation, but after that it's a clear benefit. 32GB shared buffers, empty. The test creates N new relations and then rolls back. tps tps num relations HEAD precheck 1 46.11 45.22 2 43.24 44.87 4 35.14 44.20 8 28.72 42.79 I don't understand the regression at 1, TBH. I think it must be a random code layout issue, because the same pre-check in DropRelationBuffers() (exercised via TRUNCATE of a newly created relation), shows a tiny speedup.