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 1lJXWh-0006AJ-99 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Mar 2021 08:15:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJXWg-0006yN-8w for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Mar 2021 08:15:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lJXWg-0006yF-1y for pgsql-hackers@lists.postgresql.org; Tue, 09 Mar 2021 08:15:34 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lJXWd-0008O3-TR for pgsql-hackers@postgresql.org; Tue, 09 Mar 2021 08:15:33 +0000 Received: by mail-pj1-x1029.google.com with SMTP id j14-20020a17090a588eb02900cefe2daa2cso651077pji.0 for ; Tue, 09 Mar 2021 00:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6hQFXfkvfoNGnh4lcAXqr9JQOEvxyh1gg8TD9CyONWg=; b=aa1u2u+eGhNQEyOIIWqjDMx6n6IF3vm+I6UfmL6zHUGbUoDp9kPs8/zigKwqSd7++E kXKOHGyz0Y2p+255dl0l7YMTfbFNchx1lmpgeZcxIalkMXg0JBmZp/mdz4mUM+wC4Pat OMgSkhdOjNj086L5hczSRV8RNuoba7Y3dPWx2Nb+LI6LqLy+B4v/S7TB5x0LMJOp9l8K oLPZ2zfL0+8HSnNY/6zU5b8stYdXXr3BFa42NDK46IVJB7uZMi6fv/OxvQCDxH2PumVl usVksxF9KyV3NOk0RK1G4cKvFfE6WtcRWud9VZvHk5wq2I6oxKB6c2PW+WIFw3r10l5d WKaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6hQFXfkvfoNGnh4lcAXqr9JQOEvxyh1gg8TD9CyONWg=; b=ekVFuP/V5CGOqrQkmW0EEutdASlO1Lg3fznn7q1qPXRUnZs6I+cOdZSm0vDKSKInmR MjIg86WJ7q/G5iAh2N5wUTuvTNzikyz6JxcCyFqtyFfcreHX+EMr7+AimKX8qd/da1m5 zb/73BfxSTp05Fju1hrKYyS4tXFjrNp9OWhIR1ISaLrwi11yg0LiG0fi+WFtIMYDAhcd lCpV+uQ8a9vURHu+nN7TrbNmhooe4Sh5qTY//BH/P/SYJpACUhobVXMMCljBhOvlkQq1 Ht+9YrLiDPliWOnNyw7+5XMH/hiOHa+yNp9BuTV/fQ2jHLlnfHiKJBV00e9AXy7afjk9 uGfA== X-Gm-Message-State: AOAM533miKS4TptYAlpLDg+na1w0wWNbPmM8vrskebOoGDcFoBsMVxKX QzMfRTFykabgzrYJ59RnMqqISFYR5e8wN1QGo9U= X-Google-Smtp-Source: ABdhPJyzP1IRxebZ5dleCgBZCJSdnxTXhPDEjJ8oK5O9hDHkga55RduJb3W+UMdmFhTf7DJfZvbNFJsJrPJNcMhbAHs= X-Received: by 2002:a17:90a:cf8f:: with SMTP id i15mr3573223pju.22.1615277729957; Tue, 09 Mar 2021 00:15:29 -0800 (PST) MIME-Version: 1.0 References: <20201217050522.GU30237@telsasoft.com> <20201217204442.GX30237@telsasoft.com> <20201218175439.GA30237@telsasoft.com> <20201221074725.GF30237@telsasoft.com> <20201225023958.GW30237@telsasoft.com> <96eaa813-4ad6-e80a-04a4-cc8082d356dd@swarm64.com> <508af801-6356-d36b-1867-011ac6df8f55@swarm64.com> In-Reply-To: From: Bharath Rupireddy Date: Tue, 9 Mar 2021 13:45:18 +0530 Message-ID: Subject: Re: New Table Access Methods for Multi and Single Inserts To: Dilip Kumar Cc: Luc Vlaming , Justin Pryzby , PostgreSQL-development , Andres Freund , Paul Guo , Jeff Davis Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 8, 2021 at 6:37 PM Dilip Kumar wrote: > > On Sat, Feb 20, 2021 at 11:15 AM Bharath Rupireddy > wrote: > > > > Please review the v3 patch set further. > > > > Below is the performance gain measured for CREATE TABLE AS with the > > new multi insert am propsed in this thread: > > > > case 1 - 2 integer(of 4 bytes each) columns, 3 varchar(8), tuple size > > 59 bytes, 100mn tuples > > on master - 185sec > > on master with multi inserts - 121sec, gain - 1.52X > > > > case 2 - 2 bigint(of 8 bytes each) columns, 3 name(of 64 bytes each) > > columns, 1 varchar(8), tuple size 241 bytes, 100mn tuples > > on master - 367sec > > on master with multi inserts - 291sec, gain - 1.26X > > > > case 3 - 2 integer(of 4 bytes each) columns, tuple size 32 bytes, 100mn tuples > > on master - 130sec > > on master with multi inserts - 105sec, gain - 1.23X > > > > case 4 - 2 bigint(of 8 bytes each) columns, 16 name(of 64 bytes each) > > columns, tuple size 1064 bytes, 10mn tuples > > on master - 120sec > > on master with multi inserts - 115sec, gain - 1.04X > > Performance numbers look good, especially with the smaller tuple size. Thanks. > I was looking into the patch and I have a question. > > +static inline void > +table_insert_v2(TableInsertState *state, TupleTableSlot *slot) > +{ > + state->rel->rd_tableam->tuple_insert_v2(state, slot); > +} > + > +static inline void > +table_multi_insert_v2(TableInsertState *state, TupleTableSlot *slot) > +{ > + state->rel->rd_tableam->multi_insert_v2(state, slot); > +} > > Why do we need to invent a new version table_insert_v2? And also why > it is named table_insert* instead of table_tuple_insert*? New version, because we changed the input parameters, now passing the params via TableInsertState but existing table_tuple_insert doesn't do that. If okay, I can change table_insert_v2 to table_tuple_insert_v2? Thoughts? With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com