Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 3F1C39FBF33 for ; Wed, 18 Jul 2007 16:25:05 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 29833-07 for ; Wed, 18 Jul 2007 16:24:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from pat.uio.no (pat.uio.no [129.240.10.15]) by postgresql.org (Postfix) with ESMTP id C60B59FBF03 for ; Wed, 18 Jul 2007 16:25:00 -0300 (ADT) Received: from mail-mx2.uio.no ([129.240.10.30]) by pat.uio.no with esmtp (Exim 4.67) (envelope-from ) id 1IBF8t-0004Mk-N3; Wed, 18 Jul 2007 21:24:59 +0200 Received: from smtp.uio.no ([129.240.10.9] helo=mail-mx2.uio.no) by mail-mx2.uio.no with esmtp (Exim 4.67) (envelope-from ) id 1IBF8t-0003cn-A2; Wed, 18 Jul 2007 21:24:59 +0200 Received: from 113.80-203-240.nextgentel.com ([80.203.240.113] helo=[10.0.0.128]) by mail-mx2.uio.no with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1IBF8t-0003ci-3P; Wed, 18 Jul 2007 21:24:59 +0200 Message-ID: <469E68E2.9080206@ifi.uio.no> Date: Wed, 18 Jul 2007 21:24:18 +0200 From: Thomas Finneid User-Agent: Thunderbird 1.5.0.12 (X11/20070604) MIME-Version: 1.0 To: Kalle Hallivuori CC: pgsql-performance@postgresql.org Subject: Re: improvement suggestions for performance design References: <40362.134.32.140.234.1183637748.squirrel@webmail.uio.no> <468CEB32.30109@enterprisedb.com> <40891.134.32.140.234.1183642557.squirrel@webmail.uio.no> <468D3AF7.4070505@enterprisedb.com> <468D6F68.7090903@ifi.uio.no> <4690B725.5070303@ifi.uio.no> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-UiO-SPF-Received: X-UiO-Resend: resent X-UiO-SPF-Received: X-UiO-Spam-info: not spam, SpamAssassin (score=0.0, required=12.0, autolearn=disabled, none) X-UiO-Scanned: A85F52592DF50C084385FB5546A2A37D73212FAF X-UiO-SPAM-Test: remote_host: 129.240.10.9 spam_score: 0 maxlevel 200 minaction 2 bait 0 mail/h: 191 total 2889924 max/h 8345 blacklist 0 greylist 0 ratelimit 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/229 X-Sequence-Number: 25913 Kalle Hallivuori wrote: > Hi. > > 2007/7/8, Thomas Finneid : >> >> Kalle Hallivuori wrote: >> >> > COPY is plentitudes faster than INSERT: >> > http://www.postgresql.org/docs/8.1/interactive/sql-copy.html >> > >> > If you can't just push the data straight into the final table with >> > COPY, push it into a temporary table that you go through with the >> > database procedure. >> > >> > Shameless plug: If you use Java and miss COPY functionality in the >> > driver, it's available at >> > >> > http://kato.iki.fi/sw/db/postgresql/jdbc/copy/ >> > >> > I was able to practically nullify time spent inserting with that. >> >> Interresting, I will definately have a look at it. >> What is the maturity level of the code at this point? and what is >> potentially missing to bring it up to production quality? (stability is >> of the utmost importance in my usage scenario.) > > It's my third implementation, based on earlier work by Kris Jurka, a > maintainer of the JDBC driver. (It is really quite short so it's easy > to keep it clear.) I consider it mature enough to have accommodated it > as part of an upcoming large application, but I'd really like to hear > others' opinions. Documentation I should add one of these days, maybe > even rewrite the javadoc. Hi I have tested your COPY patch (actually I tested postgresql-jdbc-8.2-505-copy-20070716.jdbc3.jar) and it is really fast, actually just as fast as serverside COPY (boths tests was performed on local machine). This means I am interrested in using it in my project, but I have some concerns that needs to be adressed, (and I am prepared to help in any way I can). The following are the concerns I have - While testing I got some errors, which needs to be fixed (detailed below) - The patch must be of production grade quality - I would like the patch to be part of the official pg JDBC driver. The error I got the most is : This command runs a single run, single thread and generates 10000 rows of data tofi@duplo:~/svn/pores$ java -server -Xms20m -Xmx256m -cp /usr/java/jdk1.5.0_06/jre/lib/rt.jar:.:src/:test/:conf/:lib/postgresql-jdbc-8.2-505-copy-20070716.jdbc3.jar wg.daemon.Main -m SINGLE_WRITE -t 1 -r 1 -c 10000 -p CPBulk Initialising connection... Performing insert... Build bulk data time: 0s 211ms toString() bulk data time: 0s 4ms time: 0s 205ms org.postgresql.util.PSQLException: Unexpected command completion while copying: COPY at org.postgresql.core.v3.QueryExecutorImpl.executeCopy(QueryExecutorImpl.java:706) at org.postgresql.copy.CopyManager.copyIntoDB(CopyManager.java:50) at org.postgresql.copy.CopyManager.copyIntoDB(CopyManager.java:37) at wg.storage.pores1.CPBulk.addAttributes(CPBulk.java:72) at wg.daemon.Daemon.run(Daemon.java:57) tofi@duplo:~/svn/pores$ ls -al lib/ regards thomas