Re: bulk inserts

From: Dave Huber <DHuber(at)letourneautechnologies(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: bulk inserts
Date: 2009-09-28 21:35:53
Message-ID: 7CDADB576E07AC4FA71E1B12566C9126540E0A0C2E@lti-mb-1.LTI.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks, Sam and Martijn. I am attempting to use the COPY command now. I had misunderstood what was meant by STDIN and assumed I could only use a file for my application and wasn't aware of PQputCopyData(). One assumption I am operating under right now is that the format of the binary file is the same as the buffer in PQputCopyData, including the header. If I am wrong, could someone please let me know? Thanks,

Dave

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Sam Mason
Sent: Monday, September 28, 2009 3:53 PM
To: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] bulk inserts

On Mon, Sep 28, 2009 at 10:38:05AM -0500, Dave Huber wrote:
> Using COPY is out of the question as the file is not formatted for
> that and since other operations need to occur, the file needs to be
> read sequentially anyway.

Just to expand on what Martin said; if you can generate a set of EXECUTE
commands, you can certainly generate a COPY command to insert the same
data. The advantage is a large drop in parse time for inserting larger
numbers of rows. As you're saying you want to insert 500 rows, I'd
suggest at least trying to get COPY working.

--
Sam http://samason.me.uk/

--
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

This electronic mail message is intended exclusively for the individual(s) or entity to which it is addressed. This message, together with any attachment, is confidential and may contain privileged information. Any unauthorized review, use, printing, retaining, copying, disclosure or distribution is strictly prohibited. If you have received this message in error, please immediately advise the sender by reply email message to the sender and delete all copies of this message.
THIS E-MAIL IS NOT AN OFFER OR ACCEPTANCE: Notwithstanding the Uniform Electronic Transactions Act or any other law of similar import, absent an express statement to the contrary contained in this e-mail, neither this e-mail nor any attachments are an offer or acceptance to enter into a contract, and are not intended to bind the sender, LeTourneau Technologies, Inc., or any of its subsidiaries, affiliates, or any other person or entity.
WARNING: Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-09-28 22:03:12 Re: bulk inserts
Previous Message Magnus Hagander 2009-09-28 20:59:11 pgday.eu 2009: Schedule available and registration open