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 1pOyTU-0001zh-Oy for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 10:11:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pOyTT-0006sK-FF for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 10:11:47 +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 1pOyTT-0006sA-5M for pgsql-hackers@lists.postgresql.org; Mon, 06 Feb 2023 10:11:47 +0000 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOyTQ-0004Lz-2y for pgsql-hackers@postgresql.org; Mon, 06 Feb 2023 10:11:45 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 5903C2B06016; Mon, 6 Feb 2023 05:11:42 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 06 Feb 2023 05:11:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1675678301; x=1675685501; bh=2 5evCfa5BUdcXo0LC5Iho4zplNBGMS4z/dHGT8z/Jes=; b=KGaM80nip0uX5TgQk /hKqfwwZ+J/h/oG4K9kpJA7lpB1RqPGvHlxcvkDgpPCIaVxYGxYVIAladPVmtJXD R7Uqj+OXJW2Phjli34i5lrHZ95Bd9DWb7r/eEKcHR+EKLdYycMIZ7R9e6QUUSTYa uAeODLeXhrFxx4v5CM14TKSQHI8uSqBNHSVSLQdFTbeNeqEfws7zNwg29kZmM5Zi cCvXejNpsVAzCqozOxmvPA8klO5igMMpC9CfWP6HxTH68qevLbMMj/25KDvNsH/i Z+m+jhI8mMauGx/s0I45vn1XUPDUrKbuuFTJepubywRfOQuDllKGCFyPmuIgA0E8 BbXQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudegiedgudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Feb 2023 05:11:40 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id EDF999D; Mon, 6 Feb 2023 11:11:32 +0100 (CET) Date: Mon, 6 Feb 2023 11:11:32 +0100 From: Alvaro Herrera To: Yugo NAGATA Cc: Tom Lane , Fabien COELHO , pgsql-hackers@postgresql.org Subject: Re: pgbench: using prepared BEGIN statement in a pipeline could cause an error Message-ID: <20230206101132.3oge5d5ovoirvxhb@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220930100743.e08533490f3b1b6f797cf431@sraoss.co.jp> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I'm writing my own patch for this problem. While playing around with it, I noticed this: struct Command { PQExpBufferData lines; /* 0 24 */ char * first_line; /* 24 8 */ int type; /* 32 4 */ MetaCommand meta; /* 36 4 */ int argc; /* 40 4 */ /* XXX 4 bytes hole, try to pack */ char * argv[256]; /* 48 2048 */ /* --- cacheline 32 boundary (2048 bytes) was 48 bytes ago --- */ char * varprefix; /* 2096 8 */ PgBenchExpr * expr; /* 2104 8 */ /* --- cacheline 33 boundary (2112 bytes) --- */ SimpleStats stats; /* 2112 40 */ int64 retries; /* 2152 8 */ int64 failures; /* 2160 8 */ /* size: 2168, cachelines: 34, members: 11 */ /* sum members: 2164, holes: 1, sum holes: 4 */ /* last cacheline: 56 bytes */ }; Not great. I suppose this makes pgbench slower than it needs to be. Can we do better? -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre)