pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: colinthart@gmail.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: COPY performance vs insert
Date: Tue, 17 Mar 2020 17:02:25 -0400
Message-ID: <20200317210225.GA17915@momjian.us> (raw)
In-Reply-To: <158149950563.1204.12282341954153208338@wrigleys.postgresql.org>
References: <158149950563.1204.12282341954153208338@wrigleys.postgresql.org>

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  <bruce@momjian.us>        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 +





view thread (2+ messages)

Message-ID: <20200317210225.GA17915@momjian.us>
Permalink:  ../20200317210225.GA17915@momjian.us/
Also on:    postgresql.org/message-id/20200317210225.GA17915@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, colinthart@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: COPY performance vs insert
  In-Reply-To: <20200317210225.GA17915@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox