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.96) (envelope-from ) id 1wLji2-001zF2-0W for pgsql-hackers@arkaria.postgresql.org; Sat, 09 May 2026 15:35:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wLjhz-00DQDo-2N for pgsql-hackers@arkaria.postgresql.org; Sat, 09 May 2026 15:35:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wLjhy-00DQDf-2k for pgsql-hackers@lists.postgresql.org; Sat, 09 May 2026 15:35:15 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wLjhv-00000001PkU-1IyB for pgsql-hackers@postgresql.org; Sat, 09 May 2026 15:35:14 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 172BE1D000A7; Sat, 9 May 2026 11:35:08 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Sat, 09 May 2026 11:35:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1778340907; x= 1778427307; bh=2RMQIpz6ZdO9E2zqi8i7tIBfJKC2PrbOp//t9+PtiwA=; b=M y8ePAiFModnFzMlcZkFI9kW1jO+3pqHRGLfa0pkV+qp1wVKmJxCn90OmSmKV2sxG iin8SkNfP4wDc3wJzHXUwaeVnuOjuVNv56Ssm6os/PI1gKCCnrRuMVfx1Fk/zNrE 4jMpnkQO/2zejEpBatf/cyq2vLuB56Lxivgn6s6Q1UgP0hB1f2o9TcbgznK7PXWE 9dqCetukGMxsUd5+MFZlrGvrFg+0pLvXGoNOxfF8AfEIxQFnWq1hwiDrPwVXS/N9 NH7pv2M9dFLLeIoKiyDWoNXI0WPkCNS+xc+1m3m45UFYL0GwvrF8lSg8EasnufC3 wS/Lj0hXaBWShg9TlX+aA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1778340907; x=1778427307; bh=2 RMQIpz6ZdO9E2zqi8i7tIBfJKC2PrbOp//t9+PtiwA=; b=dyYNKh9QZpdt9FRbH qdXhOQPMdnhBc+ME3vgyfhVSe6twbI4BmUZ9HEs+3xLFwN/l7pQdx8w1rwV/VOS3 OrGpKKja2CLZLeAkgXTmEfHfEtDbHsq6cXdVJIv9aacvnu824pCE9jaYfZeMAql3 Umjqg1wjKx9YW5pa/XDusCrU2jN366rGYY9OMs3Fr/uH1q0GeNuOpW9QM/F6UUOM y8VWK564kIpbemPUCSgVis2WgWPRjBYYhhFrwEiqRmJWCf3Sb2Y8E8OlwQclzsu7 QVeMJ1Xt4bdiIIDtesBa/gGL8hbtpmHwJmXqWydCthbx2wOtq3M7jwW8tJm690S3 tLErw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduudefiedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeetuedvheffkeevgfeuheevteevkefggedttdeufeeuheduuddthfef fffhjeefffenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgv sehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegughhrohiflhgvhihmlhesghhmrghilhdrtghomhdprhgtphht thhopehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehmrg hsrghordhfuhhjihhisehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgr tghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 9 May 2026 11:35:07 -0400 (EDT) Received: by ida.kurilemu.internal (Postfix, from userid 1000) id B555CB05F76; Sat, 09 May 2026 17:35:05 +0200 (CEST) Date: Sat, 9 May 2026 17:35:05 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Chao Li Cc: PostgreSQL-development , David Rowley , Fujii Masao Subject: Re: Avoid unnecessary StringInfo allocation in tablesync COPY buffer Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5B2C9B4C-EAE6-4F21-AF99-613A561D26DC@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, On 2026-May-09, Chao Li wrote: > I found this issue while reviewing the patch [1] and was suggested use > a separate thread for the issue. > > In tablesync.c, copy_table() currently does: > ``` > copybuf = makeStringInfo(); > ``` > > But copybuf is only used by copy_read_data(), and there it's really > just acting as a small state holder for data, len, and cursor, rather > than as a normal growable StringInfo. I find this coding pattern weird and ugly and confusing. If what we need is three variables, shouldn't we have three variables instead of this strange misuse of the StringInfo abstraction? -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "We have labored long to build a heaven, only (Prof. Milton Glass) to find it populated with horrors" (Watchmen, Alan Moore)