pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedInserting a large number of records
6+ messages / 4 participants
[nested] [flat]
* Inserting a large number of records
@ 2005-07-14 14:15 Greg Alton <greg@cfdev.com>
0 siblings, 1 reply; 6+ messages in thread
From: Greg Alton @ 2005-07-14 14:15 UTC (permalink / raw)
To: pgsql-jdbc
What is the most efficient way to insert a large number of records into
a table?
Greg Alton
ActivSoftware
http://www.activsoftware.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Inserting a large number of records
@ 2005-07-14 15:05 Oliver Jowett <oliver@opencloud.com>
parent: Greg Alton <greg@cfdev.com>
0 siblings, 1 reply; 6+ messages in thread
From: Oliver Jowett @ 2005-07-14 15:05 UTC (permalink / raw)
To: Greg Alton <greg@cfdev.com>; +Cc: pgsql-jdbc
Greg Alton wrote:
> What is the most efficient way to insert a large number of records into
> a table?
I use a PreparedStatement INSERT and addBatch() / executeBatch() with
autocommit off and no constraints or indexes present.
-O
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Inserting a large number of records
@ 2005-07-14 15:41 Steve Wampler <swampler@noao.edu>
parent: Oliver Jowett <oliver@opencloud.com>
0 siblings, 3 replies; 6+ messages in thread
From: Steve Wampler @ 2005-07-14 15:41 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc
Oliver Jowett wrote:
> Greg Alton wrote:
>
>>What is the most efficient way to insert a large number of records into
>>a table?
>
>
> I use a PreparedStatement INSERT and addBatch() / executeBatch() with
> autocommit off and no constraints or indexes present.
Does anyone have an idea as to how the performance of this would compare
to using a COPY? I've used the COPY patches with jdbc and 7.4.x with
impressive results, but if the above is 'nearly' as good then I don't have
to put off upgrading to 8.x while waiting on jdbc to officially include
support for COPY. (I can't test the above right now. Maybe soon, though.)
Thanks!
Steve
--
Steve Wampler -- swampler@noao.edu
The gods that smiled on your birth are now laughing out loud.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Inserting a large number of records
@ 2005-07-14 17:20 Dave Cramer <pg@fastcrypt.com>
parent: Steve Wampler <swampler@noao.edu>
2 siblings, 0 replies; 6+ messages in thread
From: Dave Cramer @ 2005-07-14 17:20 UTC (permalink / raw)
To: Steve Wampler <swampler@noao.edu>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc
It will never be as fast as COPY
Dave
On 14-Jul-05, at 11:41 AM, Steve Wampler wrote:
> Oliver Jowett wrote:
>
>> Greg Alton wrote:
>>
>>
>>> What is the most efficient way to insert a large number of
>>> records into
>>> a table?
>>>
>>
>>
>> I use a PreparedStatement INSERT and addBatch() / executeBatch() with
>> autocommit off and no constraints or indexes present.
>>
>
> Does anyone have an idea as to how the performance of this would
> compare
> to using a COPY? I've used the COPY patches with jdbc and 7.4.x with
> impressive results, but if the above is 'nearly' as good then I
> don't have
> to put off upgrading to 8.x while waiting on jdbc to officially
> include
> support for COPY. (I can't test the above right now. Maybe soon,
> though.)
>
> Thanks!
> Steve
> --
> Steve Wampler -- swampler@noao.edu
> The gods that smiled on your birth are now laughing out loud.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that
> your
> message can get through to the mailing list cleanly
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Inserting a large number of records
@ 2005-07-15 08:33 Oliver Jowett <oliver@opencloud.com>
parent: Steve Wampler <swampler@noao.edu>
2 siblings, 0 replies; 6+ messages in thread
From: Oliver Jowett @ 2005-07-15 08:33 UTC (permalink / raw)
To: Steve Wampler <swampler@noao.edu>; +Cc: pgsql-jdbc
Steve Wampler wrote:
> Oliver Jowett wrote:
>
>>Greg Alton wrote:
>>
>>
>>>What is the most efficient way to insert a large number of records into
>>>a table?
>>
>>
>>I use a PreparedStatement INSERT and addBatch() / executeBatch() with
>>autocommit off and no constraints or indexes present.
>
>
> Does anyone have an idea as to how the performance of this would compare
> to using a COPY? I've used the COPY patches with jdbc and 7.4.x with
> impressive results, but if the above is 'nearly' as good then I don't have
> to put off upgrading to 8.x while waiting on jdbc to officially include
> support for COPY. (I can't test the above right now. Maybe soon, though.)
I have one dataset that is about 20 million rows and takes about 40
minutes to import via batched INSERTs including translation from the
original format (I'd guess perhaps 10-15% overhead). The same dataset
dumped by pg_dump in COPY format takes about 15 minutes to restore
(using psql not JDBC though)
-O
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Inserting a large number of records
@ 2005-07-15 11:47 Dave Cramer <pg@fastcrypt.com>
parent: Steve Wampler <swampler@noao.edu>
2 siblings, 0 replies; 6+ messages in thread
From: Dave Cramer @ 2005-07-15 11:47 UTC (permalink / raw)
To: Steve Wampler <swampler@noao.edu>; +Cc: Oliver Jowett <oliver@opencloud.com>; pgsql-jdbc
Here's a version ( a little old ) of the driver with copy implemented.
http://download.postgresintl.com/copy.tar.gz
Dave
On 14-Jul-05, at 11:41 AM, Steve Wampler wrote:
> Oliver Jowett wrote:
>
>> Greg Alton wrote:
>>
>>
>>> What is the most efficient way to insert a large number of
>>> records into
>>> a table?
>>>
>>
>>
>> I use a PreparedStatement INSERT and addBatch() / executeBatch() with
>> autocommit off and no constraints or indexes present.
>>
>
> Does anyone have an idea as to how the performance of this would
> compare
> to using a COPY? I've used the COPY patches with jdbc and 7.4.x with
> impressive results, but if the above is 'nearly' as good then I
> don't have
> to put off upgrading to 8.x while waiting on jdbc to officially
> include
> support for COPY. (I can't test the above right now. Maybe soon,
> though.)
>
> Thanks!
> Steve
> --
> Steve Wampler -- swampler@noao.edu
> The gods that smiled on your birth are now laughing out loud.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that
> your
> message can get through to the mailing list cleanly
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2005-07-15 11:47 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-14 14:15 Inserting a large number of records Greg Alton <greg@cfdev.com>
2005-07-14 15:05 ` Oliver Jowett <oliver@opencloud.com>
2005-07-14 15:41 ` Steve Wampler <swampler@noao.edu>
2005-07-14 17:20 ` Dave Cramer <pg@fastcrypt.com>
2005-07-15 08:33 ` Oliver Jowett <oliver@opencloud.com>
2005-07-15 11:47 ` Dave Cramer <pg@fastcrypt.com>
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