Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7D19D2E0301 for ; Tue, 5 Feb 2008 17:43:39 -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 93838-07 for ; Tue, 5 Feb 2008 17:43:35 -0400 (AST) Received: from exprod6og103.obsmtp.com (exprod6og103.obsmtp.com [64.18.1.185]) by postgresql.org (Postfix) with SMTP id B005C2E3F12 for ; Tue, 5 Feb 2008 17:43:33 -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 13:43:31 PST Received: from D01SMTP04.Mi8.com ([172.16.1.243]) by Outbound02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Feb 2008 16:45:29 -0500 Received: from MI8NYCMAIL04.Mi8.com ([172.16.1.156]) by D01SMTP04.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Feb 2008 16:45:29 -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 21:44:36 +0000 User-Agent: Microsoft-Entourage/11.3.6.070618 Date: Tue, 05 Feb 2008 13:42:36 -0800 Subject: Performance comparison to psql. From: Arie Ozarov To: Message-ID: Thread-Topic: Performance comparison to psql. Thread-Index: AchoQAWHRE0dXNQzEdydtwAbY591dg== Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-OriginalArrivalTime: 05 Feb 2008 21:45:29.0147 (UTC) FILETIME=[6CBB50B0:01C86840] X-TM-AS-Product-Ver: SMEX-7.0.0.1345-5.0.1023-15712.001 X-TM-AS-Result: No--0.526100-8.000000-31 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/19 X-Sequence-Number: 18226 We compared insert & select operations between jdbc (postgres 8.2, postgresql-8.2-506.jdbc3.jar) and psql. Here are some numbers: PSQL *COPY* from STDIN recordsCount = 10 000 000 WITHOUT INDEXES: time = 50544 ms (*0.005 ms* per record) WITH 2 INDEXES: time = 221491 ms (*0.022 ms* per record) *JDBC (prepared statement without batch)* recordsCount = 100 000 WITHOUT INDEXES: time = 64874 ms (*0.649 **ms* per record) WITH 2 INDEXES: time = 63057 ms (*0.630 ms* per record) *JDBC (**prepared statement with batch**)* recordsCount = 1 000 000 WITHOUT INDEXES: time = 73205 ms (*0.073** ms* per record) WITH 2 INDEXES: time = 100270 ms (*0.100 ms* per record) Comparison table (records inserted per millisecond) COPY JDBC JDBC batch WITHOUT INDEXES: 198 1.5 14 WITH 2 INDEXES: 45 1.5 10 As for select/queries psql was about 3 times faster. Both psql and jdbc operations were done remotely from the same machine. 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?) Any performance improvement in postgresql-8.2-507.jdbc4.jar? Is the copy operation much more optimized than inserts (and if so when/will the driver support it)? Thanks, Arie.