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 1rpOOZ-006UbG-Q8 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 08:12:28 +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 1rpOOY-00BlTL-FT for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 08:12:26 +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.94.2) (envelope-from ) id 1rpOOY-00BlTD-5c for pgsql-hackers@lists.postgresql.org; Wed, 27 Mar 2024 08:12:26 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rpOOW-006j1R-D4 for pgsql-hackers@postgresql.org; Wed, 27 Mar 2024 08:12:25 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6e6ca2ac094so5530992b3a.0 for ; Wed, 27 Mar 2024 01:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1711527141; x=1712131941; 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=12foGhyMRZWvSkzM0hwU0IVHBt1qRc2oyCSOiWKAFc4=; b=kcP4vDmX1O8tICQdSZ7bOvwzgppii2CsnpVDzYVdnMuZE9BS5zvdmY+17g4wjdWtmI O0xDgTbrixksuQRnTOzgGx4kCnI+o7m2TMBlhvI1IwoFIUDHdYmV3TY9y4MijsA/SoFe 2c0JLfjwRn8rwWF9R+t47XUubCJ0UeblgFmxmQirq+brBR6+AL8Ho/QPO/d5CP7SzrlR z4nyVearIRhK8/d91BmDvDbqw+3mBtAZgEZjyPlL8/sdNXzaxKmPpglR/qejgLl0foo6 ul1Uiq946+0/7Cu94aRGrR4hkDCNWc/4aAAJ9G5hej5poEoibLUy7BYpY9d9SYK2m1dg 5nuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711527141; x=1712131941; 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=12foGhyMRZWvSkzM0hwU0IVHBt1qRc2oyCSOiWKAFc4=; b=wMOjXFyBLiF9n4H1GQQO9Sg8daVUI/iwo3nC9FMkHzuI9lbn42Lef95BFR45rxlZEl a62NF61+ZRUPsvi8f9y2ihbdGmFpATEArg66gZazY5N3JJCr6hlOmRvZhaHHcmAZ3UpW /ZNzG12HEcLUeotiZSJnmJ7RQ70pgnhbM2jaSOU2UhQoGpq4kGFx7uMGL3ClYEPnXR9L x35j9GTeQ7wH2Jm4M3yv3MndTeD73GycVniUI0vidOY8z/AubLAUM4FLvoNR3e8YqOeV C1rFbvBt3Kn+O8cYdulLFYrtK5v6fOhrCb+BnZVi2+9lw2itpTzUcADMdmJiRr2AN/v7 C3cQ== X-Forwarded-Encrypted: i=1; AJvYcCUwF/WyXUpRw/IcLXdr9zPmm81nv849S9m2lruJk/tF+Dh5iR3cnYmiq6wfuYpoUE9bMKhKr29gmTnhsxVduhGExTRJ2UyGrw5+iPOX X-Gm-Message-State: AOJu0Yw/5Bu42pIeCv8dcKv2dZF+l+N7ga1ZV0leolU80jGCfREZA4g6 jOFZ7RSgvI2GZsz5x5oaV7zgwfHODxt3ARH4QKLJ234Fjx6rnab3ETHXOlBlRQ== X-Google-Smtp-Source: AGHT+IGFKdwWazehFfQanGVFsn8cuNeMzOynK2ndfggQx+zXMQPBHj6m/xIj9eQzeYKK1n1C5MQZnA== X-Received: by 2002:a05:6a20:c6cd:b0:1a3:57b4:ed1c with SMTP id gw13-20020a056a20c6cd00b001a357b4ed1cmr481927pzb.25.1711527141130; Wed, 27 Mar 2024 01:12:21 -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 v17-20020a170902d09100b001dcc18e1c10sm8347791plv.174.2024.03.27.01.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 01:12:20 -0700 (PDT) Message-ID: <12f1a2d8dd3b6305c0354f1c701f44b7be5e54eb.camel@j-davis.com> Subject: Re: New Table Access Methods for Multi and Single Inserts From: Jeff Davis To: Bharath Rupireddy Cc: Masahiko Sawada , PostgreSQL-development , Andres Freund , Dilip Kumar , Luc Vlaming , Justin Pryzby , Michael Paquier , Matthias van de Meent Date: Wed, 27 Mar 2024 01:12:19 -0700 In-Reply-To: References: <20230603223824.o7iyochli2dwwi7k@alap3.anarazel.de> <6be6f58815dc0844fbe058edf56b4e735a6efc1c.camel@j-davis.com> <2280bf7241119bb88cbe0fe5eb36490cbd04c0c0.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 Wed, 2024-03-27 at 01:19 +0530, Bharath Rupireddy wrote: >=20 > Similarly, with this new AM, the onus lies on the table AM > implementers to provide an implementation for these new AMs even if > they just do single inserts. Why not fall back to using the plain tuple_insert? Surely some table AMs might be simple and limited, and we shouldn't break them just because they don't implement the new APIs. >=20 > table_multi_insert needs to be there for sure as COPY ... FROM uses > it. After we have these new APIs fully in place and used by COPY, what will happen to those other APIs? Will they be deprecated or will there be a reason to keep them? > FWIW, I can try writing a test table AM that uses this new AM but > just > does single inserts, IOW, equivalent to table_tuple_insert(). > Thoughts? More table AMs to test against would be great, but I also know that can be a lot of work. >=20 > Firstly, we are not storing CommandId and options in > TableModifyState, > because we expect CommandId to be changing (per Andres comment). Trying to make this feature work across multiple commands poses a lot of challenges: what happens when there are SELECTs and subtransactions and non-deferrable constraints? Regardless, if we care about multiple CIDs, they should be stored along with the tuples, not supplied at the time of flushing. > You mean, writes are not flushed to the disk? Can you please > elaborate > why it's different for INSERT INTO ... SELECT and not others? Can't > the new flush AM be helpful here to implement any flush related > things? Not a major problem. We can discuss while working on IIS support. I am concnerned that the flush callback is not a part of the API. We will clearly need that to support index insertions for COPY/IIS, so as- is the API feels incomplete. Thoughts? Regards, Jeff Davis