pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Copying records from TABLE_A to TABLE_B (in the same database)
Date: Tue, 2 Aug 2022 21:41:57 +0200
Message-ID: <20220802194157.d6uoa5mwtsg2jbd4@hjp.at> (raw)
In-Reply-To: <e00f01c6-1528-4e13-d7b4-30907f33e1db@gmail.com>
References: <5adcc923-889d-bb68-5a04-60125b6f0e96@gmail.com>
	<3e06c774-e323-db92-0cea-8600e1155600@gmx.net>
	<a91f43e2-3eb6-8232-e153-1ca9ec1199aa@gmail.com>
	<6a0b6197-c0ce-f0a0-2b2f-18f2b6e9b0fa@gmail.com>
	<e00f01c6-1528-4e13-d7b4-30907f33e1db@gmail.com>

On 2022-08-02 13:08:41 -0600, Rob Sargent wrote:
>         If you can get outside sql, the bulk copy facilities (CopyManager in
>         java) is blindingly fast for me.
> 
> 
>     ??
> 
> 
> I meant using tools other than sql (and psql).   I have java code using
> org.postgresql.copy package

I don't know that package but I'm pretty sure it's just using the
PostgreSQL COPY command.

> because straight insert was too slow for large numbers of rows.

The OP already has the data in the database. In my experience[1] copying
from one table to another is quite a bit faster that copying into the
database (and therefore also copying out AND copying in).

        hp

[1] https://github.com/hjp/dbbench/blob/master/import_pg_comparison/results/akran.2019-12-15/results.png


-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (11+ messages)

Message-ID: <20220802194157.d6uoa5mwtsg2jbd4@hjp.at>
Permalink:  ../20220802194157.d6uoa5mwtsg2jbd4@hjp.at/
Also on:    postgresql.org/message-id/20220802194157.d6uoa5mwtsg2jbd4@hjp.at

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: Copying records from TABLE_A to TABLE_B (in the same database)
  In-Reply-To: <20220802194157.d6uoa5mwtsg2jbd4@hjp.at>
  References: <5adcc923-889d-bb68-5a04-60125b6f0e96@gmail.com> <3e06c774-e323-db92-0cea-8600e1155600@gmx.net> <a91f43e2-3eb6-8232-e153-1ca9ec1199aa@gmail.com> <6a0b6197-c0ce-f0a0-2b2f-18f2b6e9b0fa@gmail.com> <e00f01c6-1528-4e13-d7b4-30907f33e1db@gmail.com> <20220802194157.d6uoa5mwtsg2jbd4@hjp.at>

* 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