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 1kzAfi-0005ga-3Q for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jan 2021 03:48:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kzAfg-0002D7-QJ for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jan 2021 03:48:40 +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 1kzAcb-0006wy-83 for pgsql-hackers@lists.postgresql.org; Tue, 12 Jan 2021 03:45:29 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kzAcY-0003nc-4W for pgsql-hackers@postgresql.org; Tue, 12 Jan 2021 03:45:28 +0000 Received: from [192.168.129.197] (unknown [94.25.177.44]) (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 F3AC721C0154; Tue, 12 Jan 2021 06:45:22 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1610423123; bh=seE1rU8R+sI1/5R/pAWHDAC3KAHhZtSe5MRvdixbk0A=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Nx0X1uNTheShljobg13XaNP6wmjlq2jcJs5ZTQp9y9xT2RuLM5XGSbNiBRK2te3wy MWr3q4KMD4aAoxRh6fV/955rc3h3IEmFNGfNu0uKS2MK6pCVj43Aiu0ibO2blhZq3A QfExBDgaejHpnay4IukyaTXfUZERwl7Bjc1dm2pw= Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions To: "Tang, Haiying" Cc: Alexey Kondratov , Michael Paquier , Ashutosh Bapat , Ashutosh Bapat , Etsuro Fujita , PostgreSQL-Dev , "Hou, Zhijie" , Amit Langote , "Tsunakawa, Takayuki" References: <8ddacbf0-d489-cd56-fecc-e09a7e02a7c1@postgrespro.ru> <9bff5ccc-8649-9699-1cdd-82b53164f9bb@postgrespro.ru> <7166ded145a947fbb11b67ebe68041f3@G08CNEXMBPEKD05.g08.fujitsu.local> <2b465f4cdeeb4a78b3096d31e8af7c77@G08CNEXMBPEKD05.g08.fujitsu.local> From: "Andrey V. Lepikhov" Organization: Postgres Professional Message-ID: <880ddd37-bada-909e-b5b3-d9d20286e963@postgrespro.ru> Date: Tue, 12 Jan 2021 08:45:19 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/11/21 4:59 PM, Tang, Haiying wrote: > Hi Andrey, > > I had a general look at this extension feature, I think it's beneficial for some application scenarios of PostgreSQL. So I did 7 performance cases test on your patch(v13). The results are really good. As you can see below we can get 7-10 times improvement with this patch. > > PSA test_copy_from.sql shows my test cases detail(I didn't attach my data file since it's too big). > > Below are the test results: > 'Test No' corresponds to the number(0 1...6) in attached test_copy_from.sql. > %reg=(Patched-Unpatched)/Unpatched), Unit is millisecond. > > |Test No| Test Case |Patched(ms) | Unpatched(ms) |%reg | > |-------|-----------------------------------------------------------------------------------------|-------------|---------------|-------| > |0 |COPY FROM insertion into the partitioned table(parition is foreign table) | 102483.223 | 1083300.907 | -91% | > |1 |COPY FROM insertion into the partitioned table(parition is foreign partition) | 104779.893 | 1207320.287 | -91% | > |2 |COPY FROM insertion into the foreign table(without partition) | 100268.730 | 1077309.158 | -91% | > |3 |COPY FROM insertion into the partitioned table(part of foreign partitions) | 104110.620 | 1134781.855 | -91% | > |4 |COPY FROM insertion into the partitioned table with constraint(part of foreign partition)| 136356.201 | 1238539.603 | -89% | > |5 |COPY FROM insertion into the foreign table with constraint(without partition) | 136818.262 | 1189921.742 | -89% | > |6 |\copy insertion into the partitioned table with constraint. | 140368.072 | 1242689.924 | -89% | > > If there is any question on my tests, please feel free to ask. > > Best Regard, > Tang Thank you for this work. Sometimes before i suggested additional optimization [1] which can additionally speed up COPY by 2-4 times. Maybe you can perform the benchmark for this solution too? [1] https://www.postgresql.org/message-id/da7ed3f5-b596-2549-3710-4cc2a602ec17%40postgrespro.ru -- regards, Andrey Lepikhov Postgres Professional