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 1oipz7-0006pp-UN for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Oct 2022 04:38:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oipz5-0001W6-R1 for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Oct 2022 04:38:15 +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 1oipz5-0001V7-C4 for pgsql-hackers@lists.postgresql.org; Thu, 13 Oct 2022 04:38:15 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oipyy-0005Hh-BQ for pgsql-hackers@postgresql.org; Thu, 13 Oct 2022 04:38:14 +0000 Received: from [192.168.28.53] (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 69CC021C4806; Thu, 13 Oct 2022 07:38:06 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1665635886; bh=EsObgVRO6GoO/+52lhjBbxTuOoyQCbSMxc7FyYymURo=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=YocfPdAmiQYDH3BR+imlVH9lZGFBzSvRFMjS+JItBtCHJxqEXcUv+R0L5nG4OCFgJ ri3fTCrx8rVmSpfLVrNekMM5ceagRzFfHBx1Q8HQTaW9c7zvctDAujjuXVQaKxXGyc SVRHTEZMwVOjLU+aQ8sx0q0lNtwzjK54d71/wrao= Message-ID: Date: Thu, 13 Oct 2022 09:38:05 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: Fast COPY FROM based on batch insert To: Etsuro Fujita Cc: Zhihong Yu , Justin Pryzby , Amit Langote , tanghy.fnst@fujitsu.com, Ashutosh Bapat , Pg Hackers , Tomas Vondra , houzj.fnst@fujitsu.com References: <57733596-5fd6-07ec-d65c-67411411f10e@postgrespro.ru> <05bc8819-3e53-d884-a0d0-a17ffa5febef@postgrespro.ru> <09ff35ff-291f-d9e9-a0ed-55e6bb9732fc@postgrespro.ru> Content-Language: en-US From: Andrey Lepikhov Organization: Postgres Professional In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/12/22 07:56, Etsuro Fujita wrote: > On Tue, Oct 11, 2022 at 3:06 PM Andrey Lepikhov > wrote: >> I reviewed the patch one more time. Only one question: bistate and >> ri_FdwRoutine are strongly bounded. Maybe to add some assertion on >> (ri_FdwRoutine XOR bistate) ? Just to prevent possible errors in future. > > You mean the bistate member of CopyMultiInsertBuffer? Yes > > We do not use that member at all for foreign tables, so the patch > avoids initializing that member in CopyMultiInsertBufferInit() when > called for a foreign table. So we have bistate = NULL for foreign > tables (and bistate != NULL for plain tables), as you mentioned above. > I think it is a good idea to add such assertions. How about adding > them to CopyMultiInsertBufferFlush() and > CopyMultiInsertBufferCleanup() like the attached? In the attached I > updated comments a bit further as well. Yes, quite enough. -- Regards Andrey Lepikhov Postgres Professional