pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
COPY performance vs insert
2+ messages / 2 participants
[nested] [flat]

* COPY performance vs insert
@ 2020-02-12 09:25  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2020-02-12 09:25 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: colinthart@gmail.com

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?


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: COPY performance vs insert
@ 2020-03-17 21:02  Bruce Momjian <bruce@momjian.us>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruce Momjian @ 2020-03-17 21:02 UTC (permalink / raw)
  To: colinthart@gmail.com; pgsql-docs@lists.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 +





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-03-17 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 09:25 COPY performance vs insert PG Doc comments form <noreply@postgresql.org>
2020-03-17 21:02 ` Bruce Momjian <bruce@momjian.us>

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