From: Kalle Hallivuori <kato@iki.fi>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: FYI: porting Copy API to 8.x
Date: Wed, 13 Jun 2007 16:26:38 +0300
Message-ID: <c637d8bb0706130626v40ce1976g1ac45a581759cc76@mail.gmail.com> (raw)
In-Reply-To: <Pine.BSO.4.64.0706130400400.12996@leary.csoft.net>
References: <c637d8bb0705300529y6dfd9938o21b4921f5efae39a@mail.gmail.com>
<66D125B2-3C81-467E-BC02-D784ACDD5499@fastcrypt.com>
<c637d8bb0705301245k72336d56i53335c9f26b79746@mail.gmail.com>
<B59ADA13-6701-4562-B669-9C601D62FC5F@fastcrypt.com>
<c637d8bb0706080405j7fc53c65p139c4bbc2a10cc45@mail.gmail.com>
<c637d8bb0706111255i7d16e5a3qe8dceddaf7447c4b@mail.gmail.com>
<Pine.BSO.4.64.0706130400400.12996@leary.csoft.net>
Hi Kris!
Happy to receive feedback.
2007/6/13, Kris Jurka <books@ejurka.com>:
> This patch doesn't apply cleanly because there's a mix of unix and windows
> EOL characters and it seems to have some other application problems.
Sorry for that. I'll pay closer attention to the format in future.
> The API is not thread safe. If two threads are using the same connection
> the synchronization in QueryExecutorImpl prevents them from stepping on
> each others toes and writing garbage to the backend. So the call to
> QueryExecutor must be an atomic operation and implies that the
> QueryExecutorImpl will be the controller and demand/push data from some
> kind of copy client instead of the other way around.
Yes. (I thought that was alright since I spotted a statement of no
support for synchronization somewhere, but that turned out to be at
lower level, pgStream.)
I'll look into current synchronization and hopefully I'll be able (as
in have the time) to do that.
> Also I'm not especially fond of the row based API that you've come up
> with. It seems like you should either go to an element or stream based
> API. Who has a premade row? ...
It doesn't matter what kinds of chunks you feed it (I think that was
ingenious of the COPY specification writers). With a CSV file you can
read it as a whole into a single byte[] and write that at once. Or you
can have static size byte buffer and pass it repeatedly to write().
In my application I now succesfully collect a bunch of field values as
separate byte[]'s mixed with references to static instances of
delimiter byte[]'s into a large, static size byte[][], write when it
fills up, repeat until out of data. Cut time spent in import by half.
(The other half of import time is spent post-processing the data :))
However, if that isn't intuitive it has to be explained clearly in all
documentation or a more intuitive API offered.
I think you're right on all accounts. I'll try to find some time to
make it synchronized and self-evident. Shouldn't be too much of an
effort now.
--
Kalle Hallivuori +358-41-5053073 http://korpiq.iki.fi/
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-jdbc@postgresql.org
Cc: kato@iki.fi, books@ejurka.com
Subject: Re: FYI: porting Copy API to 8.x
In-Reply-To: <c637d8bb0706130626v40ce1976g1ac45a581759cc76@mail.gmail.com>
References: <c637d8bb0705300529y6dfd9938o21b4921f5efae39a@mail.gmail.com> <66D125B2-3C81-467E-BC02-D784ACDD5499@fastcrypt.com> <c637d8bb0705301245k72336d56i53335c9f26b79746@mail.gmail.com> <B59ADA13-6701-4562-B669-9C601D62FC5F@fastcrypt.com> <c637d8bb0706080405j7fc53c65p139c4bbc2a10cc45@mail.gmail.com> <c637d8bb0706111255i7d16e5a3qe8dceddaf7447c4b@mail.gmail.com> <Pine.BSO.4.64.0706130400400.12996@leary.csoft.net> <c637d8bb0706130626v40ce1976g1ac45a581759cc76@mail.gmail.com>
* 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