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 1oAhyX-0008Lk-8N for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Jul 2022 01:12:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oAhyW-0000h2-3m for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Jul 2022 01:12:36 +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 1oAhyV-0000Fk-Em for pgsql-hackers@lists.postgresql.org; Mon, 11 Jul 2022 01:12:35 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oAhyS-0008GY-4O for pgsql-hackers@postgresql.org; Mon, 11 Jul 2022 01:12:35 +0000 Received: by mail-pj1-x102f.google.com with SMTP id y14-20020a17090a644e00b001ef775f7118so6877491pjm.2 for ; Sun, 10 Jul 2022 18:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=8pfnnkLNVbsiSDZsVezOVARv3lnlxtw9NvLWCMqH0bk=; b=CyQpJ47ZWJsXB/JO4laTFZVfutaDuDhOrwkJZ5pg5eD4yPxTVr7dKLzZHwufLZnf9H nnEaYHNTFsBTiyA2SDnTN0k6d8KjCJwQhsFeR5i3vVaTbhkp+ZeNtRHNEVTLWfuBv4gs jg2d+z5Pc6hDo1u6fyikJG23/IFcwWHUYDxVpX/48gJ2Q/Dh/7l/i+terf/2uuK+mtCI YP6rMoTofMpsesXqJYTMoR6p/ZI5n0ZlVTU4wpuJe7IIwAc+zd1P3kN1lanqO+TjAJ67 BKFLZyOsyk7riVR/Tg/91SNqUTRfNZmXGG4Jw0xQNNESx4QuipQ5TjYkoyBGqskysd8A Elyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=8pfnnkLNVbsiSDZsVezOVARv3lnlxtw9NvLWCMqH0bk=; b=3crwBHIw9e9aNRM84pAUkDuw9NoVQ/6IRC/a0Vl7dSoupP+40R0YA5oejiSH9EQrZm MLiBZeOPMe6GnAGxYcXgjIaLGVhy1QXu6XIC4C94fSIrGSGhqq6KYGtYltbJKLZnQkWV sQeb23kzreozayjv4OcTDXMS+vel5hvtbFwNldYmAJixUeqnzAXDzNkiF2u9uB5+kJDW 21je5AMG4I8NhvmWHocbFm9fFVPlMkCI4Zf/NhASkJREYzHDcF7DYW0Wipe85Ly6HJJr vwDC30na8Oxx/I590UkMkMkJTtMaFvZz074qxZhcch1925PP1hSDRk5aov0oyXZCFyya jcwQ== X-Gm-Message-State: AJIora+BfSiIUMjvfW5L9AfayvvsjWRinGiKK4gGZ0Gpv9lovd9rG++r Xwf7oQtrs8aN/fTOV+SFBw0AtoIuaawyWJCau1mby3pCy7t/SBODcL6dsSCi1UOv663RaO6we3o NOZ+jelp5dfjPHVR4LVejMEOjgGO+4a6ksAs7zUwxDoVSjbKvSHTIdylIk8hGPJUak/cyyzFdN+ tEwquix5g2suiXhqyy0HV50I6hXfhLcYkPQoKA X-Google-Smtp-Source: AGRyM1sq2+XM8Gak8uk+DofM+No4aicdKvX3iW37SeUGnaZgPzwcJnHu6RNHZziYQkUxluT4SAessQ== X-Received: by 2002:a17:902:8209:b0:16c:2da4:e734 with SMTP id x9-20020a170902820900b0016c2da4e734mr12082581pln.43.1657501949861; Sun, 10 Jul 2022 18:12:29 -0700 (PDT) Received: from ?IPV6:2400:4050:8ae0:eb00:213:3bff:fe5a:27e7? ([2400:4050:8ae0:eb00:213:3bff:fe5a:27e7]) by smtp.gmail.com with ESMTPSA id i131-20020a628789000000b0052844157f09sm3460383pfe.51.2022.07.10.18.12.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Jul 2022 18:12:29 -0700 (PDT) Message-ID: <4ad1dcea-0eef-6ad4-8314-589dbceeebc5@enterprisedb.com> Date: Mon, 11 Jul 2022 10:12:26 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Fast COPY FROM based on batch insert Content-Language: en-US To: Andrey Lepikhov Cc: Justin Pryzby , Zhihong Yu , Amit Langote , tanghy.fnst@fujitsu.com, Ashutosh Bapat , Pg Hackers , Tomas Vondra , Etsuro Fujita , houzj.fnst@fujitsu.com References: <20210323032322.GW4203@telsasoft.com> <20210409004956.GN6592@telsasoft.com> <45ad1b94-339b-a841-8885-67ebe6fc5bc1@postgrespro.ru> <065fde84-f688-c411-28eb-a3b9084b38b7@enterprisedb.com> <811b36f0-8888-7036-f4c5-0bfbdfad0bbf@postgrespro.ru> <17be446f-65a5-b49e-e57c-5629431e26b1@enterprisedb.com> From: Ian Barwick In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 09/07/2022 00:09, Andrey Lepikhov wrote: > On 8/7/2022 05:12, Ian Barwick wrote: >>      ERROR:  bind message supplies 0 parameters, but prepared statement "pgsql_fdw_prep_178" requires 6 >>      CONTEXT:  remote SQL command: INSERT INTO public.foo_part_1(t, v1, v2, v3, v4, v5) VALUES ($1, $2, $3, $4, $5, $6) >>      COPY foo, line 88160 > Thanks, I got it. MultiInsertBuffer are created on the first non-zero flush of tuples into the partition and isn't deleted from the buffers list until the end of COPY. And on a subsequent flush in the case of empty buffer we catch the error. > Your fix is correct, but I want to propose slightly different change (see in attachment). LGTM. Regards Ian Barwick -- https://www.enterprisedb.com/