Re: Copying records from TABLE_A to TABLE_B (in the same database)

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Copying records from TABLE_A to TABLE_B (in the same database)
Date: 2022-08-02 19:41:57
Message-ID: 20220802194157.d6uoa5mwtsg2jbd4@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Munro 2022-08-03 02:49:14 Re: Strange collation names ("hu_HU.UTF-8")
Previous Message Rob Sargent 2022-08-02 19:08:41 Re: Copying records from TABLE_A to TABLE_B (in the same database)