Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jEJM6-0004vJ-1h for pgsql-docs@arkaria.postgresql.org; Tue, 17 Mar 2020 21:02:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jEJM4-0004Dq-QV for pgsql-docs@arkaria.postgresql.org; Tue, 17 Mar 2020 21:02:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jEJM4-0004De-Fb for pgsql-docs@lists.postgresql.org; Tue, 17 Mar 2020 21:02:28 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jEJM1-0006jG-WA for pgsql-docs@lists.postgresql.org; Tue, 17 Mar 2020 21:02:27 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jEJM1-0006SX-74; Tue, 17 Mar 2020 17:02:25 -0400 Date: Tue, 17 Mar 2020 17:02:25 -0400 From: Bruce Momjian To: colinthart@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: COPY performance vs insert Message-ID: <20200317210225.GA17915@momjian.us> References: <158149950563.1204.12282341954153208338@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <158149950563.1204.12282341954153208338@wrigleys.postgresql.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Feb 12, 2020 at 09:25:05AM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/12/populate.html > Description: > > I think this could be clearer. In particular, performance of COPY vs INSERT > from a query (INSERT INTO ... SELECT FROM ...) or INSERT with a list of rows > (INSERT INTO ... VALUES (), (), (), ...) > Is there any performance benefit with COPY in those cases? COPY input/outputs rows in bulk, so it is still faster to do COPY than INSERT INTO ... SELECT FROM or INSERT INTO ... VALUES. You can run tests to prove it. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +