Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 99CBB2E02E3 for ; Tue, 5 Feb 2008 19:09:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 57864-10 for ; Tue, 5 Feb 2008 19:09:18 -0400 (AST) Received: from exprod6og103.obsmtp.com (exprod6og103.obsmtp.com [64.18.1.185]) by postgresql.org (Postfix) with SMTP id E8C552E008F for ; Tue, 5 Feb 2008 19:09:16 -0400 (AST) Received: from source ([63.240.6.3]) (using TLSv1) by exprod6ob103.postini.com ([64.18.5.12]) with SMTP; Tue, 05 Feb 2008 15:09:14 PST Received: from d01smtp06.Mi8.com ([172.16.1.239]) by Outbound01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Feb 2008 18:11:12 -0500 Received: from MI8NYCMAIL04.Mi8.com ([172.16.1.156]) by d01smtp06.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Feb 2008 18:11:11 -0500 Received: from 71.5.1.203 ([71.5.1.203]) by MI8NYCMAIL04.Mi8.com ([172.16.1.204]) via Exchange Front-End Server mi8owa.mi8.com ([172.16.1.134]) with Microsoft Exchange Server HTTP-DAV ; Tue, 5 Feb 2008 23:11:06 +0000 User-Agent: Microsoft-Entourage/11.3.6.070618 Date: Tue, 05 Feb 2008 15:09:07 -0800 Subject: Re: Performance comparison to psql. From: Arie Ozarov To: Kris Jurka CC: Message-ID: Thread-Topic: [JDBC] Performance comparison to psql. Thread-Index: AchoTBuaWjbIHtQ/EdydtwAbY591dg== In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-OriginalArrivalTime: 05 Feb 2008 23:11:11.0775 (UTC) FILETIME=[65FA12F0:01C8684C] X-TM-AS-Product-Ver: SMEX-7.0.0.1345-5.0.1023-15712.001 X-TM-AS-Result: No--16.515700-8.000000-31 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/22 X-Sequence-Number: 18229 Would it be better than to group inserts using standard statement (not prepared - or does it really matter) this way: insert into T values (set1), (set2),..,(setN); ? Any reason for a select statement to be 3 times slower? When is it planned to include the copy support in the official version? Thanks! Arie. On 2/5/08 2:31 PM, "Kris Jurka" wrote: > > > On Tue, 5 Feb 2008, Arie Ozarov wrote: > >> I understand that JDBC has some overhead (object translation,..) but didn't >> think the difference would be that big. Do this numbers look correct (any >> optimization suggestion?) > > The real cost is the protocol level overhead of INSERT vs COPY. JDBC > batch execution groups things together to reduce the number of network > round trips, but it still has to send each insert as an individual request > to the server. > >> Any performance improvement in postgresql-8.2-507.jdbc4.jar? >> > > No. > >> Is the copy operation much more optimized than inserts (and if so when/will >> the driver support it)? >> > > Yes, copy is significantly faster than insert. If you'd like, construct a > psql test case that does 100,000 individual inserts and you'll see it's > not just a JDBC driver/libpq difference. > > Copy support is available using this patched driver, but it has not been > integrated into the official version yet. > > http://kato.iki.fi/sw/db/postgresql/jdbc/copy/ > > Kris Jurka >