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 1lJFc7-0003nq-7A for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Mar 2021 13:07:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJFc6-0002wJ-5l for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Mar 2021 13:07:58 +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 1lJFc5-0002uL-V3 for pgsql-hackers@lists.postgresql.org; Mon, 08 Mar 2021 13:07:57 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lJFc3-0005ba-Rg for pgsql-hackers@postgresql.org; Mon, 08 Mar 2021 13:07:56 +0000 Received: by mail-lf1-x12a.google.com with SMTP id x4so14175208lfu.7 for ; Mon, 08 Mar 2021 05:07:55 -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=baWPfvo4OIuLhloo2WEQjHK8sQbLSfft5+Q6Cc4s1Go=; b=L6Pp5gd1zso2YOhtCaBQqtTdUyrywznyxAiVn8QCrn0YKc4fjQ9Xuj8e2xmg+bxxM6 lJVofWmLTUMg9AoRyWXIGPC0qn56tZo855MSEXGT4X4/9lbPneEkRLDOrOQp+m2cmq8N 5m+6zMA1QNEVuCZID4ZqqLR5Hiy46FtwlITPzSZw5dTK9/YktPPtTpQuyoUvKpDqdfPN u6nqzgCU+A3fneP0os+o2AtACflyE7Nf493g6G4GiuP/d+OIsfyg8VRRmG3ND2ssh4Jn Tsk9VBm4OKe/RlC7R8PbUINo2wroFfvJS1TJJ8NLu5NdQsIHunnyL00teRqEmIjS7UVf IRvg== 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=baWPfvo4OIuLhloo2WEQjHK8sQbLSfft5+Q6Cc4s1Go=; b=gz24ZBxquExyMhzEdbZHKsJlJpKRtJe7hzl5ljs1WVOZM+raeF+wnVZjoSQHJV9nVH sR8TItvH5Ru5OwCYR8H3vj7OoqJkN10QpDOga1irbn7fC7vwxXyfHAWbTTt0qCSGC+BU lcE+buCgiaY0noyKO7gxZLLcxtX2VcBj/rCt54zO4LoMpBO2qE9cjMjxXLDe8Jssa8PE vBDZllGpdhbJ6EX3Vkl5WCQItt4i+Wc6andfR+pLml4pPjFyV2ov1E03pae1kAkA/Wm2 nq378W9CIQMbdRVhOb+xvVF3dNBmXCc4I6c3RlYKZm2V2zBQrPbF9oH/HhOrlVYQv+kg 4KQw== X-Gm-Message-State: AOAM532PUgBbw6GflQASumXpYQYFqNTdNEXmrYMsiZB4nkhjG/Ol5RqJ YiAh25cqmOlgwLAPAZmYpwnfgtwYu2O34vIWvT117X7zdHCl1w== X-Google-Smtp-Source: ABdhPJxVvcTby69SC//8HiHCkfDEpIvbTLKhZjRMQTwNQjbUhGWSc1EeS0YFQDPVAMSGKi0Fpgw8NO9xLcth62qsrgE= X-Received: by 2002:a05:6512:acb:: with SMTP id n11mr14083024lfu.288.1615208874214; Mon, 08 Mar 2021 05:07:54 -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: Dilip Kumar Date: Mon, 8 Mar 2021 18:37:38 +0530 Message-ID: Subject: Re: New Table Access Methods for Multi and Single Inserts To: Bharath Rupireddy 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 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. 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*? -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com