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.94.2) (envelope-from ) id 1sioyS-009nMn-LM for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Aug 2024 05:42:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sioyP-002DvG-V2 for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Aug 2024 05:42:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sioyP-002Dv8-FT for pgsql-hackers@lists.postgresql.org; Tue, 27 Aug 2024 05:42:34 +0000 Received: from mail-yw1-x112a.google.com ([2607:f8b0:4864:20::112a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sioyN-001dU8-3P for pgsql-hackers@postgresql.org; Tue, 27 Aug 2024 05:42:32 +0000 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-6c32daf0797so51047557b3.0 for ; Mon, 26 Aug 2024 22:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1724737350; x=1725342150; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=AuWIPPYe2ggUzEi1KEw6+vPXzQdF46GvhiBXO8DjAnk=; b=dFfvYwfsZ9tZ0u5MPuIhCQ+V5X9xXa05NBeSVEft9yfDWJ+BmcNhU/4vI1Ixb++gMa kZlmHhb9AVHgRhEyONlctCRy+QWWXJhbexaVRcJW5lBDe34++vnhVfHOqKTPB6lCBZ+0 WRNX9AMNV186KX7qtQNRdVZ7J+/iHtRIC71Bn2BgBzVzllkh7eiUS/JWMLNUle3+JVLf yAU1gAyHUlrUp01a6Sa0jKwFbaM6eVHgR8ozM5NCtFKFouVq0NTIH/sYPkGlzT7Ry9km 1KYlyjX9fRmydIgM/404lTUXx2SB6BoVGEZwa8OkNDwCRcP592jpbo2yVfpg72Xm5ax6 oh0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724737350; x=1725342150; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AuWIPPYe2ggUzEi1KEw6+vPXzQdF46GvhiBXO8DjAnk=; b=dZWhiC7G/HEcODMuAWjnoLqk8alN+y1pscpODZafZXTOI2bpcejpM1NQEG2T8i9ar8 ebpDMAlg6SMW+WhG7zfxbG06fo+5CTNKbvPSkrtdFobS86zlQjTHoBC+1YfqOEg8o6X+ KfidVDTaDI7oDpOcd/jlwPfBsBuL/yK4Mo5/c0YkVkq+AJ7L247/UrZ9aipJt+x+1/X8 Ru/2+I0dxhs3rnl/CvdmCBdMLwhJHoI1LIEQG5XPdBawwxV6oUbCcxdzvwE/UVWiXPPt Lt99Lfs9YQUvv02weMY1mIYW9kk7X6Tg3WE/rLOO6SN+hoU9Gf1nZnOauFmmU33LvHD6 DOpQ== X-Forwarded-Encrypted: i=1; AJvYcCX6Q0zo1yvc2VxispYfCynjPKLCfKNecRJrKhoMNGxVr1PgUY3Tw7rXDd1OP3sgRHBDNICKWS5MS65P+ZEZ@postgresql.org X-Gm-Message-State: AOJu0Ywo+ZUX8ymhPzqqYIyYttjtmzAoP2WuekoQ4KuN+FFnz76k0f7N s0+zdDq8+OAtmMJg1btIadJzBCptu8Kb0k1NNTCMLcMIP4HDfhenwd3G8A7F86wL+/M+q10Jc9A = X-Google-Smtp-Source: AGHT+IHKMcnbUrdganPi9ogs6hSmdhRRnwb23Sglo/ea5rUgkX2BXOGu+vyFqFPKFrtKdWtnGnw7ww== X-Received: by 2002:a05:690c:6104:b0:6b1:18bd:a79d with SMTP id 00721157ae682-6cfbbbd4c82mr19696987b3.40.1724737350063; Mon, 26 Aug 2024 22:42:30 -0700 (PDT) Received: from jeff-laptop.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7143425109asm7858348b3a.67.2024.08.26.22.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 22:42:29 -0700 (PDT) Message-ID: <51eee6f21ab5d93b3bbf8dc04b6b5f7501cf7c99.camel@j-davis.com> Subject: Re: Introduce new multi insert Table AM and improve performance of various SQL commands with it for Heap AM From: Jeff Davis To: Matthias van de Meent , Bharath Rupireddy Cc: Masahiko Sawada , PostgreSQL-development , Andres Freund , Dilip Kumar , Luc Vlaming , Justin Pryzby , Michael Paquier , Alexander Korotkov Date: Mon, 26 Aug 2024 22:42:27 -0700 In-Reply-To: References: <20230603223824.o7iyochli2dwwi7k@alap3.anarazel.de> <6be6f58815dc0844fbe058edf56b4e735a6efc1c.camel@j-davis.com> <2280bf7241119bb88cbe0fe5eb36490cbd04c0c0.camel@j-davis.com> <12f1a2d8dd3b6305c0354f1c701f44b7be5e54eb.camel@j-davis.com> <8633171cb034aafc260fdf37df04b6c779aa1e2f.camel@j-davis.com> <229c4f7219ed164088dadc935df21e1cf125e191.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2024-08-26 at 23:59 +0200, Matthias van de Meent wrote: > Specifically, I'm having trouble seeing how this could be used to > implement ```INSERT INTO ... SELECT ... RETURNING ctid``` as I see no > returning output path for the newly inserted tuples' data, which is > usually required for our execution nodes' output path. Is support for > RETURN-clauses planned for this API? In a previous iteration, the > flush operation was capable of returning a TTS, but that seems to > have > been dropped, and I can't quite figure out why. I'm not sure where that was lost, but I suspect when we changed flushing to use a callback. I didn't get to v23-0003 yet, but I think you're right that the current flushing mechanism isn't right for returning tuples. Thank you. One solution: when the buffer is flushed, we can return an iterator over the buffered tuples to the caller. The caller can then use the iterator to insert into indexes, return a tuple to the executor, etc., and then release the iterator when done (freeing the buffer). That control flow is less convenient for most callers, though, so perhaps that should be optional? Regards, Jeff Davis